NTRT Simulator
|
#include <tgModel.h>
Inherits tgTaggable.
Inherited by BaseSpineModelLearning, BuildTestModel, ConnectorTestModel, ContactTestModel, FlemonsSpineModel, Hilbert2DModel, NestedStructureTestModel, NestedStructureTestModel, PrismModel, RBStringTest, SingleRibModel, SingleRibModel, StructureTestModel, T6Model, tgBaseString, and tgRod.
Public Member Functions | |
tgModel () | |
tgModel (const tgTags &tags) | |
tgModel (std::string space_separated_tags) | |
virtual | ~tgModel () |
virtual void | setup (tgWorld &world) |
virtual void | teardown () |
virtual void | step (double dt) |
virtual void | onVisit (const tgModelVisitor &r) const |
void | addChild (tgModel *pChild) |
virtual std::string | toString (std::string prefix="") const |
template<typename T > | |
std::vector< T * > | find (const tgTagSearch &tagSearch) |
template<typename T > | |
std::vector< T * > | find (const std::string &tagSearch) |
std::vector< tgModel * > | getDescendants () const |
void | addTags (const std::string &space_separated_tags) |
void | addTags (const tgTags &tags) |
bool | hasTag (const std::string tag) const |
bool | hasAllTags (std::string tags) |
bool | hasAnyTags (const std::string tags) |
bool | hasNoTags () |
tgTags & | getTags () |
const tgTags & | getTags () const |
void | setTags (tgTags tags) |
std::string | getTagStr (std::string delim=" ") const |
A root-level model is a Tensegrity. It can contain sub-models. The Composite design pattern is used for the sub-models.
tgModel::tgModel | ( | ) |
The default constructor. Primarily used within the tgCreator for compounded objects and subclasses of tgModel
Definition at line 32 of file tgModel.cpp.
tgModel::tgModel | ( | const tgTags & | tags | ) |
Constructor for a model with tags, used within tgCreator for things that are already tagged
[in] | tgTags,tags | for the tgTaggable parent class |
Definition at line 38 of file tgModel.cpp.
tgModel::tgModel | ( | std::string | space_separated_tags | ) |
Constructor for sace seperated tags
[in] | space_seperated_tags,tags | for the tgTaggable parent class |
Definition at line 44 of file tgModel.cpp.
|
virtual |
Destructor. Deletes the children, if they weren't already deleted by teardown()
Definition at line 50 of file tgModel.cpp.
void tgModel::addChild | ( | tgModel * | pChild | ) |
Add a sub-model to this model. The model takes ownership of the child sub-model and is responsible for deallocating it.
[in,out] | pChild | a pointer to a sub-model |
std::invalid_argument | is pChild is NULL, this object, or already a descendant |
Definition at line 126 of file tgModel.cpp.
|
inline |
Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.
[in] | tagSearch,a | tagSearch that contains the desired tags |
Definition at line 129 of file tgModel.h.
|
inline |
Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.
[in] | tagSearch,a | std::string& that contains the desired tags |
Definition at line 142 of file tgModel.h.
std::vector< tgModel * > tgModel::getDescendants | ( | ) | const |
Return a std::vector of const pointers to all sub-models.
Definition at line 174 of file tgModel.cpp.
|
virtual |
Call tgModelVisitor::render() on self and all descendants.
[in,out] | r | a reference to a tgModelVisitor |
Reimplemented in ConnectorTestModel, BuildTestModel, tgLinearString, and tgRod.
Definition at line 109 of file tgModel.cpp.
|
virtual |
Setup takes a tgWorld and passes it to any children for their own setup functions. All subclasses should call this at the appropriate time (usually end of setup) within their own setup function.
[in] | world | - the tgWorld the models will exist in. |
Reimplemented in tgBaseString, NestedStructureTestModel, tgRBString, tgLinearString, PrismModel, SingleRibModel, SingleRibModel, T6Model, Hilbert2DModel, RBStringTest, ContactTestModel, StructureTestModel, BaseSpineModelLearning, ConnectorTestModel, TetraSpineLearningModel, BuildTestModel, FlemonsSpineModelLearningCL, FlemonsSpineModelLearning, RibModel, and FlemonsSpineModel.
Definition at line 62 of file tgModel.cpp.
|
virtual |
Advance the simulation.
[in] | dt | the number of seconds since the previous call; std::invalid_argument is thrown if dt is not positive |
std::invalid_argument | if dt is not positive |
Reimplemented in NestedStructureTestModel, tgBaseString, ConnectorTestModel, BuildTestModel, ContactTestModel, StructureTestModel, tgLinearString, PrismModel, NestedStructureTestModel, tgRBString, T6Model, RBStringTest, BaseSpineModelLearning, TetraSpineLearningModel, FlemonsSpineModelLearningCL, FlemonsSpineModelLearning, RibModel, and FlemonsSpineModel.
Definition at line 86 of file tgModel.cpp.
|
virtual |
Deletes the children (undoes setup)
Reimplemented in tgBaseString, ContactTestModel, tgRod, tgRBString, tgLinearString, PrismModel, T6Model, BaseSpineModelLearning, TetraSpineLearningModel, FlemonsSpineModelLearningCL, FlemonsSpineModelLearning, and RibModel.
Definition at line 73 of file tgModel.cpp.
|
virtual |
Returns the tag names of this model and its children
[in] | prefix | a string to append to |
Definition at line 156 of file tgModel.cpp.