Commit 041d3caf authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

BUG: Minor fixes to returning references to locals

Minor fixes to returning references to locals in various places.
parent 89c4588e
......@@ -47,9 +47,10 @@ GeometryMap::setMaster(std::shared_ptr<Geometry> master)
m_master = master;
}
const std::string& GeometryMap::getTypeName() const
const
std::string GeometryMap::getTypeName() const
{
switch (getType())
switch (m_type)
{
case GeometryMapType::Isometric:
return "Isometric map";
......
......@@ -69,12 +69,13 @@ public:
const GeometryMapType& getType() const;
virtual void setMaster(std::shared_ptr<Geometry> master);
const std::string& getTypeName() const;
virtual std::shared_ptr<Geometry> getMaster() const;
virtual void setSlave(std::shared_ptr<Geometry> slave);
virtual std::shared_ptr<Geometry> getSlave() const;
const std::string getTypeName() const;
///
/// \brief Returns true if the map is actively applied at runtime, else false.
///
......@@ -83,11 +84,11 @@ public:
///
/// \brief Print the map
///
virtual void printMap() const = 0;
virtual void print() const = 0;
protected:
GeometryMap(GeometryMapType type) : m_isActive(true) {}
GeometryMap(GeometryMapType type) : m_type(type), m_isActive(true) {}
GeometryMapType m_type; ///> type of the map
......
......@@ -23,7 +23,7 @@
namespace imstk {
const imstk::RigidTransform3d&
const imstk::RigidTransform3d
IdentityMap::getTransform() const
{
return imstk::RigidTransform3d::Identity();
......
......@@ -43,7 +43,7 @@ public:
// Accessors
void setTransform(const RigidTransform3d& affineTransform);
const RigidTransform3d& getTransform() const;
const RigidTransform3d getTransform() const;
};
}
......
......@@ -28,13 +28,13 @@ IsometricMap::setTransform(const RigidTransform3d& affineTransform)
m_rigidTransform = affineTransform;
}
const imstk::RigidTransform3d&
const imstk::RigidTransform3d
IsometricMap::getTransform() const
{
return m_rigidTransform;
}
void IsometricMap::printMap() const
void IsometricMap::print() const
{
std::cout << this->getTypeName() << std::endl;
}
......
......@@ -40,9 +40,9 @@ public:
// Accessors
void setTransform(const RigidTransform3d& affineTransform);
const RigidTransform3d& getTransform() const;
const RigidTransform3d getTransform() const;
void printMap() const;
void print() const;
protected:
RigidTransform3d m_rigidTransform;
......
......@@ -46,8 +46,7 @@ public:
void computeVertexTangents();
// Accessors
void setTriangleVertices(
const std::vector<TriangleArray>& triangles);
void setTriangleVertices(const std::vector<TriangleArray>& triangles);
void setTextureCoordinates(const std::vector<Vec2f>& coords);
......
......@@ -37,8 +37,8 @@ TetraTriangleMap::computeMap()
auto tetMesh = std::dynamic_pointer_cast<imstk::TetrahedralMesh> (m_master);
auto triMesh = std::dynamic_pointer_cast<imstk::SurfaceMesh> (m_slave);
int numSurfaceVertices = triMesh->getNumVertices();
int numTetrahedra = tetMesh->getNumTetrahedra();
const int numSurfaceVertices = triMesh->getNumVertices();
const int numTetrahedra = tetMesh->getNumTetrahedra();
for (int i = 0; i < numSurfaceVertices; ++i)
{
......@@ -64,7 +64,7 @@ TetraTriangleMap::computeMap()
}
int
TetraTriangleMap::findClosestTetrahedra(const std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p)
TetraTriangleMap::findClosestTetrahedra(std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p)
{
// search
double closestDistance = std::numeric_limits<double>::max();
......@@ -90,7 +90,7 @@ TetraTriangleMap::findClosestTetrahedra(const std::shared_ptr<imstk::Tetrahedral
}
int
TetraTriangleMap::findEclosingTetrahedra(const std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p)
TetraTriangleMap::findEclosingTetrahedra(std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p)
{
imstk::Vec3d boundingBoxMin;
imstk::Vec3d boundingBoxMax;
......@@ -152,18 +152,18 @@ TetraTriangleMap::setSlave(std::shared_ptr<Geometry> slave)
}
void TetraTriangleMap::printMap() const
void TetraTriangleMap::print() const
{
std::cout << this->getTypeName() << std::endl;
std::cout << "Vertex (<vertNum>): Tetrahedra: <TetNum> - Weights: (w1, w2, w3, w4)\n\n";
std::cout << "Vertex (<vertNum>): Tetrahedra: <TetNum> - Weights: (w1, w2, w3, w4)\n" << std::endl;
for (size_t i = 0; i < this->m_enclosingTetra.size(); i++)
{
std::cout << "\tVertex (" << i << "):" << "\tTetrahedra: " << m_enclosingTetra[i];
std::cout << "Vertex (" << i << "):" << "\tTetrahedra: " << m_enclosingTetra[i];
std::cout << " - Weights: "
<< "(" << m_weights.at(i)[0] << ", " << m_weights.at(i)[1] <<
", " << m_weights.at(i)[2] << ", " << m_weights.at(i)[3] << ")\n";
", " << m_weights.at(i)[2] << ", " << m_weights.at(i)[3] << ")" << std::endl;
}
}
......
......@@ -61,12 +61,12 @@ public:
///
/// \brief Find the closest tetrahedra based on the distance to their centroids for a given point in 3D space
///
static int findClosestTetrahedra(const std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p);
static int findClosestTetrahedra(std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p);
///
/// \brief Find the tetrahedra that encloses a given point in 3D space
///
static int findEclosingTetrahedra(const std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p);
static int findEclosingTetrahedra(std::shared_ptr<imstk::TetrahedralMesh> tetraMesh, const imstk::Vec3d& p);
// Accessors
......@@ -83,7 +83,7 @@ public:
///
/// \brief Print the map
///
void printMap() const;
void print() const;
protected:
std::vector<weightsArray> m_weights; ///> weights
......
......@@ -37,7 +37,7 @@ public:
// Accessors
std::shared_ptr<SurfaceMesh>getAttachedSurfaceMesh();
void setAttachedSurfaceMesh(std::shared_ptr<SurfaceMesh>surfaceMesh);
void setAttachedSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh);
protected:
......
......@@ -267,7 +267,7 @@ void testTetraTriangleMap()
tetTriMap->setSlave(triMesh);
tetTriMap->computeMap();
tetTriMap->printMap();
tetTriMap->print();
getchar();
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment