Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
iMSTK
iMSTK
Commits
43eae007
Commit
43eae007
authored
Jul 25, 2019
by
Sreekanth Arikatla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REFAC: Refactor long lines of code
parent
eeb81a4c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
22 deletions
+49
-22
Source/DataStructures/imstkUniformSpatialGrid.h
Source/DataStructures/imstkUniformSpatialGrid.h
+36
-10
Source/DynamicalModels/CMakeLists.txt
Source/DynamicalModels/CMakeLists.txt
+1
-1
Source/DynamicalModels/ObjectModels/imstkDynamicalModel.h
Source/DynamicalModels/ObjectModels/imstkDynamicalModel.h
+0
-2
Source/Geometry/Mesh/imstkSurfaceMesh.h
Source/Geometry/Mesh/imstkSurfaceMesh.h
+3
-2
Source/Geometry/Mesh/imstkVolumetricMesh.h
Source/Geometry/Mesh/imstkVolumetricMesh.h
+2
-2
Source/Geometry/Reader/imstkMSHMeshIO.h
Source/Geometry/Reader/imstkMSHMeshIO.h
+4
-3
Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.cpp
.../RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.cpp
+1
-1
Source/Solvers/imstkSPHSolver.h
Source/Solvers/imstkSPHSolver.h
+2
-1
No files found.
Source/DataStructures/imstkUniformSpatialGrid.h
View file @
43eae007
...
...
@@ -101,12 +101,14 @@ public:
/// \brief Check if cell index in dimension d is valid (d = 0/1/2 => x/y/z dimension)
///
template
<
int
d
>
bool
isValidCellIndex
(
const
int
idx
)
const
{
return
idx
>=
0
&&
static_cast
<
unsigned
int
>
(
idx
)
<
m_Resolution
[
d
];
}
bool
isValidCellIndex
(
const
int
idx
)
const
{
return
idx
>=
0
&&
static_cast
<
unsigned
int
>
(
idx
)
<
m_Resolution
[
d
];
}
///
/// \brief Check if 3D cell indices are valid
///
bool
isValidCellIndices
(
const
int
i
,
const
int
j
,
const
int
k
)
const
{
return
isValidCellIndex
<
0
>
(
i
)
&&
isValidCellIndex
<
1
>
(
j
)
&&
isValidCellIndex
<
2
>
(
k
);
}
bool
isValidCellIndices
(
const
int
i
,
const
int
j
,
const
int
k
)
const
{
return
isValidCellIndex
<
0
>
(
i
)
&&
isValidCellIndex
<
1
>
(
j
)
&&
isValidCellIndex
<
2
>
(
k
);
}
///
/// \brief Get the 3D index (cell_x, cell_y, cell_z) of the cell containing the given positions
...
...
@@ -136,53 +138,77 @@ public:
/// \brief Get data in a cell
/// \param A position in space
///
CellData
&
getCellData
(
const
Vec3r
&
ppos
)
{
return
m_CellData
[
getCellLinearizedIndex
<
unsigned
int
>
(
ppos
)];
}
CellData
&
getCellData
(
const
Vec3r
&
ppos
)
{
return
m_CellData
[
getCellLinearizedIndex
<
unsigned
int
>
(
ppos
)];
}
///
/// \brief Get data in a cell
/// \param A position in space
///
const
CellData
&
getCellData
(
const
Vec3r
&
ppos
)
const
{
return
m_CellData
[
getCellLinearizedIndex
<
unsigned
int
>
(
ppos
)];
}
const
CellData
&
getCellData
(
const
Vec3r
&
ppos
)
const
{
return
m_CellData
[
getCellLinearizedIndex
<
unsigned
int
>
(
ppos
)];
}
///
/// \brief Get data in a cell
/// \param A linearized index of cell
///
CellData
&
getCellData
(
size_t
linearizedIdx
)
{
assert
(
linearizedIdx
<
m_CellData
.
size
());
return
m_CellData
[
linearizedIdx
];
}
CellData
&
getCellData
(
size_t
linearizedIdx
)
{
assert
(
linearizedIdx
<
m_CellData
.
size
());
return
m_CellData
[
linearizedIdx
];
}
///
/// \brief Get data in a cell
/// \param A linearized index of cell
///
const
CellData
&
getCellData
(
size_t
linearizedIdx
)
const
{
assert
(
linearizedIdx
<
m_CellData
.
size
());
return
m_CellData
[
linearizedIdx
];
}
const
CellData
&
getCellData
(
size_t
linearizedIdx
)
const
{
assert
(
linearizedIdx
<
m_CellData
.
size
());
return
m_CellData
[
linearizedIdx
];
}
///
/// \brief Get data in a cell
/// \param 3D index of a cell
///
template
<
class
IndexType
>
CellData
&
getCellData
(
const
std
::
array
<
IndexType
,
3
>&
cellIdx
)
{
return
m_CellData
[
getCellLinearizedIndex
(
cellIdx
[
0
],
cellIdx
[
1
],
cellIdx
[
2
])];
}
CellData
&
getCellData
(
const
std
::
array
<
IndexType
,
3
>&
cellIdx
)
{
return
m_CellData
[
getCellLinearizedIndex
(
cellIdx
[
0
],
cellIdx
[
1
],
cellIdx
[
2
])];
}
///
/// \brief Get data in a cell
/// \param 3D index of a cell
///
template
<
class
IndexType
>
const
CellData
&
getCellData
(
const
std
::
array
<
IndexType
,
3
>&
cellIdx
)
const
{
return
m_CellData
[
getCellLinearizedIndex
(
cellIdx
[
0
],
cellIdx
[
1
],
cellIdx
[
2
])];
}
const
CellData
&
getCellData
(
const
std
::
array
<
IndexType
,
3
>&
cellIdx
)
const
{
return
m_CellData
[
getCellLinearizedIndex
(
cellIdx
[
0
],
cellIdx
[
1
],
cellIdx
[
2
])];
}
///
/// \brief Get data in a cell
/// \param 3D index of a cell
///
template
<
class
IndexType
>
CellData
&
getCellData
(
const
IndexType
i
,
const
IndexType
j
,
const
IndexType
k
)
{
return
m_CellData
[
getCellLinearizedIndex
(
i
,
j
,
k
)];
}
CellData
&
getCellData
(
const
IndexType
i
,
const
IndexType
j
,
const
IndexType
k
)
{
return
m_CellData
[
getCellLinearizedIndex
(
i
,
j
,
k
)];
}
///
/// \brief Get data in a cell
/// \param 3D index of a cell
///
template
<
class
IndexType
>
const
CellData
&
getCellData
(
const
IndexType
i
,
const
IndexType
j
,
const
IndexType
k
)
const
{
return
m_CellData
[
getCellLinearizedIndex
(
i
,
j
,
k
)];
}
const
CellData
&
getCellData
(
const
IndexType
i
,
const
IndexType
j
,
const
IndexType
k
)
const
{
return
m_CellData
[
getCellLinearizedIndex
(
i
,
j
,
k
)];
}
///
/// \brief Apply a function to all cell data
...
...
Source/DynamicalModels/CMakeLists.txt
View file @
43eae007
...
...
@@ -23,4 +23,4 @@ imstk_add_library( DynamicalModels
#-----------------------------------------------------------------------------
if
(
iMSTK_BUILD_TESTING
)
add_subdirectory
(
Testing
)
endif
()
endif
()
\ No newline at end of file
Source/DynamicalModels/ObjectModels/imstkDynamicalModel.h
View file @
43eae007
...
...
@@ -36,8 +36,6 @@ enum class DynamicalModelType
elastoDynamics
,
positionBasedDynamics
,
SPH
,
NavierStokes
,
HeatEquation
,
none
};
...
...
Source/Geometry/Mesh/imstkSurfaceMesh.h
View file @
43eae007
...
...
@@ -140,7 +140,7 @@ public:
///
/// \brief Rewire the node order and triangle connectivity to optimize for memory layout
/// The intended use is for large meshes that doesn't fit into CPU/GPU memory.
///
TODO:
Further optimization to find a 1-d uninterrupted sub-graph at each iteration.
///
\todo
Further optimization to find a 1-d uninterrupted sub-graph at each iteration.
///
void
optimizeForDataLocality
();
...
...
@@ -202,7 +202,8 @@ public:
///
/// \brief Set load factor
/// \param loadFactor the maximum number of vertices; a multiple of the original vertex count
/// \param loadFactor the maximum number of vertices
/// a multiple of the original vertex count
///
virtual
void
setLoadFactor
(
double
loadFactor
)
override
;
...
...
Source/Geometry/Mesh/imstkVolumetricMesh.h
View file @
43eae007
...
...
@@ -69,7 +69,7 @@ protected:
VolumetricMesh
(
Geometry
::
Type
type
,
const
std
::
string
name
=
std
::
string
(
""
))
:
PointSet
(
type
,
name
)
{}
std
::
shared_ptr
<
SurfaceMesh
>
m_attachedSurfaceMesh
=
nullptr
;
///> Attached surface mesh
std
::
shared_ptr
<
vega
::
VolumetricMesh
>
m_attachedVegaMesh
=
nullptr
;
///> Attached vega mesh
std
::
shared_ptr
<
SurfaceMesh
>
m_attachedSurfaceMesh
;
///> Attached surface mesh
std
::
shared_ptr
<
vega
::
VolumetricMesh
>
m_attachedVegaMesh
;
///> Attached vega mesh
};
}
// imstk
Source/Geometry/Reader/imstkMSHMeshIO.h
View file @
43eae007
...
...
@@ -55,9 +55,10 @@ public:
static
std
::
shared_ptr
<
imstk
::
VolumetricMesh
>
read
(
const
std
::
string
&
filePath
,
const
MeshFileType
meshType
);
protected:
//
// \brief Possible element types in a MSH file format as mentioned at http://www.manpagez.com/info/gmsh/gmsh-2.2.6/gmsh_63.php
//
///
/// \brief Possible element types in a MSH file format
/// as mentioned at http://www.manpagez.com/info/gmsh/gmsh-2.2.6/gmsh_63.php
///
enum
ElemType
{
line
=
1
,
...
...
Source/Rendering/VTKRenderer/RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.cpp
View file @
43eae007
...
...
@@ -95,7 +95,7 @@ VTKTetrahedralMeshRenderDelegate::updateDataSource()
if
(
geometry
->
getTopologyChangedFlag
())
{
m_mappedVertexArray
->
Modified
();
//
TODO:
only modify if vertices change
m_mappedVertexArray
->
Modified
();
//
/ \todo
only modify if vertices change
// Copy cells
auto
&
maskedTets
=
std
::
dynamic_pointer_cast
<
TetrahedralMesh
>
(
geometry
)
->
getRemovedTetrahedra
();
...
...
Source/Solvers/imstkSPHSolver.h
View file @
43eae007
...
...
@@ -42,7 +42,8 @@ public:
///
/// \brief Set the simulation object
///
void
setSPHObject
(
const
std
::
shared_ptr
<
SPHObject
>&
obj
)
{
assert
(
obj
);
m_SPHObject
=
obj
;
}
void
setSPHObject
(
const
std
::
shared_ptr
<
SPHObject
>&
obj
)
{
assert
(
obj
);
m_SPHObject
=
obj
;
}
///
/// \brief Advance one time step
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment