Commit d28f3e6d authored by Sreekanth Arikatla's avatar Sreekanth Arikatla

REFAC: const correctness and enforce style

parent ff19d1a0
......@@ -109,9 +109,9 @@ int main()
// Build floor geometry
const double width = 100.0;
const double height = 100.0;
const double height = 100.0;
const size_t nRows = 2;
const size_t nCols = 2;
const size_t nCols = 2;
const double dy = width / static_cast<double>(nCols - 1);
const double dx = height / static_cast<double>(nRows - 1);
......
......@@ -78,34 +78,34 @@ PBDCollisionHandling::generatePBDConstraints()
//std::cout << "EE: " << m_colData->EEColData.size() << "TV: " << m_colData->TVColData.size() << std::endl;
// Generate edge-edge pbd constraints
for (auto& colData : m_colData->EEColData)
{
auto c = std::make_shared<PbdEdgeEdgeConstraint>();
size_t edgeA1, edgeA2;
if (map1)
{
edgeA1 = map1->getMapIdx(colData.edgeIdA.first);
edgeA2 = map1->getMapIdx(colData.edgeIdA.second);
}
else
{
edgeA1 = colData.edgeIdA.first;
edgeA2 = colData.edgeIdA.second;
}
size_t edgeB1, edgeB2;
if (map2)
{
edgeB1 = map2->getMapIdx(colData.edgeIdB.first);
edgeB2 = map2->getMapIdx(colData.edgeIdB.second);
}
else
{
edgeB1 = colData.edgeIdB.first;
edgeB2 = colData.edgeIdB.second;
}
for (auto& colData : m_colData->EEColData)
{
auto c = std::make_shared<PbdEdgeEdgeConstraint>();
size_t edgeA1, edgeA2;
if (map1)
{
edgeA1 = map1->getMapIdx(colData.edgeIdA.first);
edgeA2 = map1->getMapIdx(colData.edgeIdA.second);
}
else
{
edgeA1 = colData.edgeIdA.first;
edgeA2 = colData.edgeIdA.second;
}
size_t edgeB1, edgeB2;
if (map2)
{
edgeB1 = map2->getMapIdx(colData.edgeIdB.first);
edgeB2 = map2->getMapIdx(colData.edgeIdB.second);
}
else
{
edgeB1 = colData.edgeIdB.first;
edgeB2 = colData.edgeIdB.second;
}
c->initConstraint(dynaModel1, edgeA1, edgeA2,
dynaModel2, edgeB1, edgeB2);
......@@ -119,19 +119,19 @@ PBDCollisionHandling::generatePBDConstraints()
const auto c = std::make_shared<PbdPointTriangleConstraint>();
size_t v1, v2, v3;
if (map2)
{
v1 = map2->getMapIdx(triVerts[0]);
v2 = map2->getMapIdx(triVerts[1]);
v3 = map2->getMapIdx(triVerts[2]);
}
else
{
v1 = triVerts[0];
v2 = triVerts[1];
v3 = triVerts[2];
}
size_t v1, v2, v3;
if (map2)
{
v1 = map2->getMapIdx(triVerts[0]);
v2 = map2->getMapIdx(triVerts[1]);
v3 = map2->getMapIdx(triVerts[2]);
}
else
{
v1 = triVerts[0];
v2 = triVerts[1];
v3 = triVerts[2];
}
c->initConstraint(dynaModel1,
colData.vertexIdB,
......
......@@ -118,16 +118,17 @@ public:
/// \return index of Master corresponding to the idx of Slave
///
virtual size_t getMapIdx(const size_t&) { return 0; }
///
/// \brief Initialize the map
///
virtual void initialize()
{
LOG_IF(FATAL, !this->isValid()) << "Map is invalid!";
this->compute();
}
///
/// \brief Initialize the map
///
virtual void initialize()
{
LOG_IF(FATAL, (!this->isValid())) << "Map is invalid!";
this->compute();
}
protected:
///
......@@ -135,16 +136,16 @@ protected:
///
GeometryMap(Type type) : m_type(type), m_isActive(true) {}
///
/// \brief Protected constructor
///
GeometryMap(std::shared_ptr<Geometry> master,
std::shared_ptr<Geometry> slave,
Type type) : m_type(type), m_isActive(true)
{
this->setMaster(master);
this->setSlave(slave);
}
///
/// \brief Protected constructor
///
GeometryMap(const std::shared_ptr<Geometry> master,
const std::shared_ptr<Geometry> slave,
Type type) : m_type(type), m_isActive(true)
{
this->setMaster(master);
this->setSlave(slave);
}
Type m_type; ///> type of the map
bool m_isActive; ///> true if the map us active at runtime
......
......@@ -43,13 +43,13 @@ public:
m_rigidTransform(RigidTransform3d::Identity())
{}
///
/// \brief Constructor
///
IsometricMap(std::shared_ptr<Geometry> master, std::shared_ptr<Geometry> slave) :
GeometryMap(GeometryMap::Type::Isometric),
m_rigidTransform(RigidTransform3d::Identity())
{}
///
/// \brief Constructor
///
IsometricMap(std::shared_ptr<Geometry> master, std::shared_ptr<Geometry> slave) :
GeometryMap(GeometryMap::Type::Isometric),
m_rigidTransform(RigidTransform3d::Identity())
{}
///
/// \brief Destructor
......
......@@ -44,15 +44,15 @@ public:
///
OneToOneMap() : GeometryMap(GeometryMap::Type::OneToOne){}
///
/// \brief Constructor
///
OneToOneMap(std::shared_ptr<Geometry> master,
std::shared_ptr<Geometry> slave) : GeometryMap(GeometryMap::Type::OneToOne)
{
this->setMaster(master);
this->setSlave(slave);
}
///
/// \brief Constructor
///
OneToOneMap(std::shared_ptr<Geometry> master,
std::shared_ptr<Geometry> slave) : GeometryMap(GeometryMap::Type::OneToOne)
{
this->setMaster(master);
this->setSlave(slave);
}
///
/// \brief Default destructor
......
......@@ -44,15 +44,15 @@ public:
///
TetraTriangleMap() : GeometryMap(GeometryMap::Type::TetraTriangle){}
///
/// \brief Constructor
///
TetraTriangleMap(std::shared_ptr<Geometry> master,
std::shared_ptr<Geometry> slave) : GeometryMap(GeometryMap::Type::TetraTriangle)
{
this->setMaster(master);
this->setSlave(slave);
}
///
/// \brief Constructor
///
TetraTriangleMap(std::shared_ptr<Geometry> master,
std::shared_ptr<Geometry> slave) : GeometryMap(GeometryMap::Type::TetraTriangle)
{
this->setMaster(master);
this->setSlave(slave);
}
///
/// \brief Destructor
......
......@@ -89,10 +89,10 @@ public:
{
if (SceneObject::initialize())
{
if (m_collidingToVisualMap)
{
m_collidingToVisualMap->initialize();
}
if (m_collidingToVisualMap)
{
m_collidingToVisualMap->initialize();
}
return true;
}
......
......@@ -120,15 +120,15 @@ public:
{
if (CollidingObject::initialize())
{
if (m_physicsToCollidingGeomMap)
{
m_physicsToCollidingGeomMap->initialize();
}
if (m_physicsToVisualGeomMap)
{
m_physicsToVisualGeomMap->initialize();
}
if (m_physicsToCollidingGeomMap)
{
m_physicsToCollidingGeomMap->initialize();
}
if (m_physicsToVisualGeomMap)
{
m_physicsToVisualGeomMap->initialize();
}
return m_dynamicalModel->initialize();
}
......
Markdown is supported
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