Skip to content
Snippets Groups Projects
Commit bff90368 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

COMP: Makes PbdConstraint abstract base class

Make PbdConstraint abstract base class with solvePositionConstraint to be implemted in base class
parent 7cf70042
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
/// ///
/// \brief Constructor /// \brief Constructor
/// ///
PbdAreaConstraint() : PbdConstraint(3) {} PbdAreaConstraint() : PbdConstraint() { m_vertexIds.resize(3); }
/// ///
/// \brief Returns PBD constraint of type Type::Area /// \brief Returns PBD constraint of type Type::Area
......
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
/// ///
/// \brief Constructor /// \brief Constructor
/// ///
PbdConstraint(const unsigned int cardinality) { m_vertexIds.resize(cardinality); } PbdConstraint() = default;
/// ///
/// \brief abstract interface to know the type of constraint /// \brief abstract interface to know the type of constraint
...@@ -66,6 +66,7 @@ public: ...@@ -66,6 +66,7 @@ public:
/// \brief update constraint /// \brief update constraint
/// \param model \class PbdModel /// \param model \class PbdModel
/// \return true if succeeded /// \return true if succeeded
/// TODO: Remove this or implement for child classes in future
/// ///
virtual bool updateConstraint(PbdModel& model) virtual bool updateConstraint(PbdModel& model)
{ {
...@@ -77,15 +78,13 @@ public: ...@@ -77,15 +78,13 @@ public:
/// \param model \class PbdModel /// \param model \class PbdModel
/// \return true if succeeded /// \return true if succeeded
/// ///
virtual bool solvePositionConstraint(PbdModel& model) virtual bool solvePositionConstraint(PbdModel& model) = 0;
{
return true;
}
/// ///
/// \brief compute delta velocity, specifically for rigid bodies /// \brief compute delta velocity, specifically for rigid bodies
/// \param model \class PbdModel /// \param model \class PbdModel
/// \return true if succeeded /// \return true if succeeded
/// TODO: Remove this or implement for child classes in future
/// ///
virtual bool solveVelocityConstraint(PbdModel& model) virtual bool solveVelocityConstraint(PbdModel& model)
{ {
...@@ -93,7 +92,7 @@ public: ...@@ -93,7 +92,7 @@ public:
} }
public: public:
std::vector<size_t> m_vertexIds; // index of points for the constraint std::vector<size_t> m_vertexIds; ///> index of points for the constraint
}; };
} }
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
/// ///
/// \brief Constructor /// \brief Constructor
/// ///
PbdDihedralConstraint() : PbdConstraint(4) {} PbdDihedralConstraint() : PbdConstraint() { m_vertexIds.resize(4); }
/// ///
/// \brief Returns PBD constraint of type Type::Dihedral /// \brief Returns PBD constraint of type Type::Dihedral
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
/// ///
/// \brief Constructor /// \brief Constructor
/// ///
PbdDistanceConstraint() : PbdConstraint(2) {} PbdDistanceConstraint() : PbdConstraint() { m_vertexIds.resize(2); }
/// ///
/// \brief Returns PBD constraint of type Type::Distance /// \brief Returns PBD constraint of type Type::Distance
......
...@@ -51,7 +51,10 @@ public: ...@@ -51,7 +51,10 @@ public:
/// \brief Constructor /// \brief Constructor
/// ///
explicit PbdFEMConstraint(const unsigned int cardinality, MaterialType mtype = MaterialType::StVK) : explicit PbdFEMConstraint(const unsigned int cardinality, MaterialType mtype = MaterialType::StVK) :
PbdConstraint(cardinality), m_material(mtype) {} PbdConstraint(), m_material(mtype)
{
m_vertexIds.resize(cardinality);
}
public: public:
double m_elementVolume; ///> Volume of the element double m_elementVolume; ///> Volume of the element
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
/// ///
/// \brief constructor /// \brief constructor
/// ///
PbdVolumeConstraint() : PbdConstraint(4) {} PbdVolumeConstraint() : PbdConstraint() { m_vertexIds.resize(4); }
/// ///
/// \brief Returns PBD constraint of type Type::Volume /// \brief Returns PBD constraint of type Type::Volume
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment