Structural deformable models
|
#include <Model.h>
Public Types | |
enum | DistType { DIST_XY, DIST_XYS, DIST_PVEC, DIST_POINTS, DIST_CPOINTS, DIST_HPOINTS } |
enum | ModelState { ST_WINNER =1, ST_LOOSER =2, ST_OLDSTATE =4, ST_DEL =8, ST_MEMBER =16, ST_NODEL =32 } |
Public Member Functions | |
Model (dataset_cptr _dataset=NULL, SensorCollection *sensors=NULL) | |
Default constructor. More... | |
Model (const Model &rhs) | |
Copy constructor. More... | |
~Model () | |
Destructor. More... | |
void | clear () |
remove and destroy all geometry information (nodes and edges) More... | |
operator bool () const | |
is initialized? More... | |
void | reset () |
reset all model information (including geometry) More... | |
int | addNode (const Node &node) |
int | addEdge (const Edge &edge) |
int | addEdge (const Node &from, const Node &to) |
int | addEdge (int ifrom, int ito) |
const Edge & | getEdge (int index) const |
Edge & | getEdge (int index) |
const Node & | getNode (int index) const |
Node & | getNode (int index) |
int | getNNodes () const |
int | getNEdges () const |
float | getNodeAngle (const Node &n) const |
void | setName (const std::string &name) |
const std::string & | getName () const |
dword | getCRC () const |
dword | getID () const |
void | setID (dword id) |
void | draw (bool drawPoints=false) const |
Draw using OpenGL. More... | |
void | drawPS (CAMgraphicsProcess &gp, dword mode=0) const |
Draw to postscrip output. More... | |
bool | readEdge (ParseFile &is) |
read edge from stream More... | |
bool | readNode (ParseFile &is) |
read node from stream More... | |
bool | readSensor (ParseFile &is) |
read sensor from stream More... | |
bool | readParameter (ParseFile &is) |
read model parameters More... | |
Model & | operator= (const Model &rhs) |
bool | readFile (const char *filename, bool fullread=true) |
bool | writeFile (const char *filename) const |
void | attachDataset (dataset_cptr dataset) |
float | getQualityOfFit () const |
float | getLiveliness () const |
void | translate (const Point &t) |
void | addNoise (float r) |
void | freeze () |
void | push (const Point &t) |
void | rotate (float angle, const Point &c) |
void | rotate (float angle) |
void | pushRotate (const Point &c, float angle) |
void | attract (const Point &c, float factor) |
float | getFullLength () const |
Returns overall sum of edge lengths. More... | |
float | getStdRadius (const Point ¢er) const |
Returns mean squared distance from centroid. More... | |
float | getStdRadius () const |
float | getMaxRadius (const Point ¢er) const |
Returns the maximum radius from the centroid. More... | |
float | getMaxRadius () const |
void | scale (float factor, bool movepoints=false) |
multiply all rest lengths by factor More... | |
void | scaleSel (float factor, const DMatrixf &selm) |
multiply all rest lengths of selected edges by factor More... | |
void | adaptRestLength (float ratio) |
adapt restlengths towards current lengths by ratio More... | |
void | adaptRestLengthSel (float ratio, const DMatrixf &selm) |
adapt restlengths of selected edges towards current lengths by ratio More... | |
void | adaptProportion (float ratio) |
overall rest lengths sum is adapted to overall edge lengths by ratio More... | |
float | getLengthRatio () const |
relation of overall edge length by overall rest length sum More... | |
float | getLengthVariation () const |
mean squared difference from restlength normalized by restlength sum More... | |
float | getDeformation () const |
normalized length variation to compensate for different sizes More... | |
float | getSensorFit (dword *npts=NULL) const |
get average sensor value More... | |
float | getEdgeSensorFit (dword *npts=NULL) const |
get average fit of sensors along edges More... | |
void | updateParticles (float dt, int method=0) |
void | resetForces () |
void | calculateForces (float dt) |
void | calculateDerivatives (std::vector< NodeDerivative > &deriv) |
float | addImageForces (float dt) |
void | addTorque (float dt) |
void | prepareTorque () |
void | mergeSensorCollection (SensorCollection *sensors) |
SensorCollection * | getSensorCollection () |
void | reattachSensors () |
get sensors from sensor collection More... | |
dword | createEdgeSensors (float dist=0.1) |
auto-create appropriate edge sensors (dist*stdRadius is distance) More... | |
const Point | getCenter () const |
float | getDirection () const |
const Node & | getDirNode () const |
void | setDirNode (int id) |
void | setWinner (bool iswin=true, float ts=0.) |
bool | isWinner () |
void | setLooser (bool isloose=true, float ts=0.) |
bool | isLooser () |
void | setOldState (bool isoldstate=true, float ts=0.) |
bool | isOldState () |
dword & | getFlags () |
bool | hasFlags (dword flags) const |
dword & | setFlags (dword flags) |
dword & | unsetFlags (dword flags) |
dword & | switchFlags (dword flags) |
void | setShapeWeight (float weight) |
void | adaptDataScale (dword ppmm=0) |
dword | getDataScale () const |
void | adaptProperties (const PropVec &prop) |
const PropVec & | getProperties () const |
PropVec | getPropertiesMM () const |
return property vector using millimeter scale More... | |
void | adaptPropertiesMM (PropVec prop) |
adapt to a property vector using millimeter scale More... | |
Point2D & | convertPointFromMM (Point2D &pt) const |
Point2D & | convertPointToMM (Point2D &pt) const |
PropVec & | convertPropFromMM (PropVec &prop) const |
PropVec & | convertPropToMM (PropVec &prop) const |
int | nearestNode (const Point &pos, float &dist=*(float *)(NULL)) const |
float | distance (const Model &rhs, enum Model::DistType kind=DIST_POINTS) const |
void | invalidatePC (dword pcflags=PC_ALL) |
dword | getInstCount () const |
void | setInstCount (dword ic) |
dword | mergeModel (Model &mergemod) |
const std::string & | getFilename () const |
void | setHLNode (int hlnode) |
int | getHLNode () const |
Returns ID of highlighted node. Value is -1 if none is selected. More... | |
dword | getSelectedNodesN (dword state=Node::ST_SELECT) const |
get number of selected nodes More... | |
dword | connectNodes () |
Connect selected nodes. More... | |
dword | removeEdges () |
Remove edges between selected nodes. More... | |
void | removeNode (int nid) |
Removes a node and its adjacent edges. More... | |
DMatrixf | adjMat () const |
compute undirected adjacency matrix More... | |
DMatrixf | selMaskMat () const |
compute mask matrix of selected nodes More... | |
Public Attributes | |
ParticleParam | phys |
physical parameter set More... | |
float | m_TimeStamp |
time stamps (see. TTimeStamp) More... | |
Protected Types | |
enum | PreCompF { PC_CENTER =0x01, PC_SCALE =0x02, PC_DIR =0x04, PC_QOF =0x08, PC_LIVE =0x10, PC_NOTHING =0x00, PC_ALL =0x1f, PC_PVEC =PC_CENTER|PC_SCALE|PC_DIR, PC_STATS =PC_QOF|PC_LIVE } |
Protected Member Functions | |
dword | removeByAdjMat (DMatrixf &adjm) |
remove edged not mentioned in (non-directional) adjacency matrix More... | |
dword | createByAdjMat (const DMatrixf &adjm) |
create edges mentioned in adjacency matrix More... | |
void | rebuildIndexTables () |
rebuild cross indexing between nodes and edges More... | |
void | attachSensorColl (SensorCollection *sc) |
set reference to and from sensor collection for correct updates More... | |
Protected Attributes | |
NodeArray | nodes |
indexed list of nodes More... | |
EdgeArray | edges |
indexed list of edges More... | |
dataset_cptr | m_Dataset |
SensorCollection * | m_Sensors |
std::string | m_SensorFile |
float | m_ShapeWeight |
dword | m_Flags |
std::string | m_Name |
dword | m_CRC |
dword | m_ppmm |
int | m_DirNodeInd |
dword | m_PCFlags |
PropVec | m_PropVec |
float | m_QOF |
float | m_Liveliness |
float | m_Scale |
float | m_Direction |
dword | m_InstCount |
number of merged instances More... | |
std::string | m_Filename |
int | m_HLNode |
dword | m_ID |
Friends | |
ParseFile & | operator>> (ParseFile &is, Model &g) |
std::ostream & | operator<< (std::ostream &is, const Model &g) |
enum Model::DistType |
Enumerator | |
---|---|
DIST_XY | |
DIST_XYS | |
DIST_PVEC | |
DIST_POINTS | |
DIST_CPOINTS | |
DIST_HPOINTS |
Definition at line 40 of file Model.h.
enum Model::ModelState |
Enumerator | |
---|---|
ST_WINNER | |
ST_LOOSER | |
ST_OLDSTATE | |
ST_DEL | |
ST_MEMBER | |
ST_NODEL |
Definition at line 43 of file Model.h.
|
protected |
Enumerator | |
---|---|
PC_CENTER | |
PC_SCALE | |
PC_DIR | |
PC_QOF | |
PC_LIVE | |
PC_NOTHING | |
PC_ALL | |
PC_PVEC | |
PC_STATS |
Definition at line 35 of file Model.h.
Model::Model | ( | dataset_cptr | _dataset = NULL , |
SensorCollection * | sensors = NULL |
||
) |
Default constructor.
Definition at line 26 of file Model.cpp.
References __SHAPEWEIGHT, DEFAULT_PPMM, ParticleParam::gravitational, m_DirNodeInd, m_ppmm, m_Sensors, m_ShapeWeight, phys, SensorCollection::refModel(), setName(), and ParticleParam::viscousdrag.
Model::Model | ( | const Model & | rhs | ) |
Copy constructor.
Definition at line 39 of file Model.cpp.
References m_Sensors, NULL, and operator=().
Model::~Model | ( | ) |
Destructor.
Definition at line 45 of file Model.cpp.
References attachSensorColl(), and NULL.
void Model::adaptDataScale | ( | dword | ppmm = 0 | ) |
Definition at line 1240 of file Model.cpp.
References m_Dataset, m_ppmm, and scale().
Referenced by attachDataset(), operator>>(), and setShapeWeight().
void Model::adaptProperties | ( | const PropVec & | prop | ) |
Definition at line 1249 of file Model.cpp.
References getCenter(), getDirection(), getPropDir(), getPropPos(), getPropScale(), getStdRadius(), nodes, rotate(), scale(), and translate().
Referenced by adaptPropertiesMM(), ExpectationMap::generateInstance(), getDataScale(), and Searcher::mutate().
void Model::adaptPropertiesMM | ( | PropVec | prop | ) |
adapt to a property vector using millimeter scale
Definition at line 1281 of file Model.cpp.
References adaptProperties(), and convertPropFromMM().
Referenced by getDataScale().
void Model::adaptProportion | ( | float | ratio | ) |
overall rest lengths sum is adapted to overall edge lengths by ratio
Definition at line 1164 of file Model.cpp.
References edges, and getLengthRatio().
Referenced by getMaxRadius(), Searcher::mutate(), and Brain::triggerTest().
void Model::adaptRestLength | ( | float | ratio | ) |
adapt restlengths towards current lengths by ratio
Definition at line 1126 of file Model.cpp.
References edges.
Referenced by getMaxRadius(), and Brain::triggerTest().
void Model::adaptRestLengthSel | ( | float | ratio, |
const DMatrixf & | selm | ||
) |
adapt restlengths of selected edges towards current lengths by ratio
Definition at line 1133 of file Model.cpp.
References edges.
Referenced by getMaxRadius(), and Brain::triggerTest().
int Model::addEdge | ( | const Edge & | edge | ) |
add an Edge to the model
Definition at line 138 of file Model.cpp.
Referenced by addEdge(), createByAdjMat(), operator bool(), readEdge(), and Brain::triggerTest().
int Model::addEdge | ( | int | ifrom, |
int | ito | ||
) |
float Model::addImageForces | ( | float | dt | ) |
Definition at line 701 of file Model.cpp.
References m_Dataset, and nodes.
Referenced by calculateForces(), and getMaxRadius().
int Model::addNode | ( | const Node & | node | ) |
add a Node to the model
Definition at line 120 of file Model.cpp.
References Node::index, nodes, and TRACE.
Referenced by addEdge(), operator bool(), readNode(), and Brain::triggerTest().
void Model::addNoise | ( | float | r | ) |
Definition at line 901 of file Model.cpp.
References dmutil::abs(), edges, frand, and nodes.
Referenced by Searcher::mutate(), setID(), and Brain::triggerTest().
void Model::addTorque | ( | float | dt | ) |
Definition at line 719 of file Model.cpp.
References edges, Node::f, Point2D::flipOrtho(), Edge::fromNode(), getNodeAngle(), m_Dataset, mapAnglePI(), nodes, Point2D::normalize(), phys, Edge::toNode(), and ParticleParam::torque.
Referenced by getMaxRadius(), and updateParticles().
DMatrixf Model::adjMat | ( | ) | const |
compute undirected adjacency matrix
compute directed adjacency matrix
Definition at line 415 of file Model.cpp.
References DMatrix< T >::at(), edges, getNNodes(), DMatrix< T >::setLower(), and DMatrix< T >::transpose().
Referenced by connectNodes(), getHLNode(), and removeEdges().
void Model::attachDataset | ( | dataset_cptr | dataset | ) |
Definition at line 85 of file Model.cpp.
References adaptDataScale(), SensorCollection::addSensor(), SensorCollection::getSensor(), m_Dataset, and m_Sensors.
Referenced by MStructure::MStructure(), and setID().
|
protected |
set reference to and from sensor collection for correct updates
Definition at line 588 of file Model.cpp.
References m_Sensors, SensorCollection::refModel(), and SensorCollection::unrefModel().
Referenced by getHLNode(), operator=(), and ~Model().
void Model::attract | ( | const Point & | c, |
float | factor | ||
) |
void Model::calculateDerivatives | ( | std::vector< NodeDerivative > & | deriv | ) |
Definition at line 839 of file Model.cpp.
References nodes.
Referenced by getMaxRadius(), and updateParticles().
void Model::calculateForces | ( | float | dt | ) |
Definition at line 648 of file Model.cpp.
References addImageForces(), Point2D::dot(), edges, ParticleParam::gravitational, ParticleParam::imgforce, nodes, Point2D::norm(), phys, and ParticleParam::viscousdrag.
Referenced by getMaxRadius(), and updateParticles().
void Model::clear | ( | ) |
remove and destroy all geometry information (nodes and edges)
Definition at line 95 of file Model.cpp.
References edges, m_DirNodeInd, and nodes.
Referenced by Searcher::clear(), MStructure::clear(), and reset().
dword Model::connectNodes | ( | ) |
Connect selected nodes.
Definition at line 483 of file Model.cpp.
References adjMat(), createByAdjMat(), DMatrix< T >::min(), prepareTorque(), selMaskMat(), and DMatrix< T >::setLower().
Referenced by getHLNode(), and Brain::triggerTest().
Definition at line 1285 of file Model.cpp.
References m_Dataset, and m_ppmm.
Referenced by convertPropFromMM(), and getDataScale().
Definition at line 1291 of file Model.cpp.
References m_Dataset, and m_ppmm.
Referenced by MStructure::buildAllStats(), convertPropToMM(), getDataScale(), and MStructure::showStats().
Definition at line 1297 of file Model.cpp.
References convertPointFromMM(), getPropPos(), getPropScale(), m_ppmm, setPropPos(), and setPropScale().
Referenced by adaptPropertiesMM(), and getDataScale().
Definition at line 1304 of file Model.cpp.
References convertPointToMM(), getPropPos(), getPropScale(), m_ppmm, setPropPos(), and setPropScale().
Referenced by getDataScale(), getPropertiesMM(), and MStructure::setRefModel().
create edges mentioned in adjacency matrix
Definition at line 468 of file Model.cpp.
References addEdge(), DMatrix< T >::at(), getNNodes(), DMatrix< T >::sizeX(), and DMatrix< T >::sizeY().
Referenced by connectNodes(), and getHLNode().
dword Model::createEdgeSensors | ( | float | dist = 0.1 | ) |
auto-create appropriate edge sensors (dist*stdRadius is distance)
Definition at line 622 of file Model.cpp.
References edges, and getStdRadius().
Referenced by getSensorCollection(), and Brain::triggerTest().
float Model::distance | ( | const Model & | rhs, |
enum Model::DistType | kind = DIST_POINTS |
||
) | const |
Definition at line 1043 of file Model.cpp.
References DIST_CPOINTS, DIST_HPOINTS, DIST_POINTS, DIST_PVEC, DIST_XY, DIST_XYS, getCenter(), getNNodes(), getProperties(), getPropSDir(), getStdRadius(), nodes, dmutil::sqrt(), Point2D::x, and Point2D::y.
Referenced by getDataScale(), and NMerge::operator()().
void Model::draw | ( | bool | drawPoints = false | ) | const |
Draw using OpenGL.
Definition at line 542 of file Model.cpp.
Referenced by Searcher::draw(), StructTable::draw(), Brain::drawAllModels(), and setID().
void Model::drawPS | ( | CAMgraphicsProcess & | gp, |
dword | mode = 0 |
||
) | const |
Draw to postscrip output.
Referenced by setID().
void Model::freeze | ( | ) |
Definition at line 938 of file Model.cpp.
References edges, and prepareTorque().
Referenced by setID().
const Point Model::getCenter | ( | ) | const |
Definition at line 852 of file Model.cpp.
References getPropPos(), m_PCFlags, m_PropVec, nodes, PC_CENTER, and setPropPos().
Referenced by adaptProperties(), MStructure::buildAllStats(), distance(), Brain::distributeModel(), Brain::evolve(), Searcher::getBindex(), getDirection(), getDirNode(), getLiveliness(), getMaxRadius(), getProperties(), getSensorCollection(), getStdRadius(), rotate(), scale(), MStructure::showStats(), and Brain::triggerTest().
|
inline |
Definition at line 204 of file Model.h.
References adaptProperties(), adaptPropertiesMM(), convertPointFromMM(), convertPointToMM(), convertPropFromMM(), convertPropToMM(), DIST_POINTS, distance(), getProperties(), getPropertiesMM(), m_ppmm, nearestNode(), and NULL.
Referenced by MStructure::addExpectation(), Searcher::buildClusters(), and MStructure::buildMasterModel().
float Model::getDeformation | ( | ) | const |
normalized length variation to compensate for different sizes
Definition at line 995 of file Model.cpp.
References edges, getLengthRatio(), scale(), ParticleParam::springconst, and dmutil::sqrt().
Referenced by getMaxRadius(), getQualityOfFit(), and Brain::triggerTest().
float Model::getDirection | ( | ) | const |
Definition at line 890 of file Model.cpp.
References getCenter(), getDirNode(), getPropDir(), m_PCFlags, m_PropVec, mapAngle2PI(), nodes, PC_DIR, and setPropDir().
Referenced by adaptProperties(), getProperties(), and getSensorCollection().
const Node & Model::getDirNode | ( | ) | const |
Definition at line 870 of file Model.cpp.
References getCenter(), getNNodes(), getNode(), m_DirNodeInd, and nodes.
Referenced by Brain::doCommand(), getDirection(), and getSensorCollection().
|
inline |
Definition at line 71 of file Model.h.
References edges.
Referenced by MStructure::buildMasterModel(), and Brain::triggerTest().
get average fit of sensors along edges
Definition at line 1191 of file Model.cpp.
References edges.
Referenced by getMaxRadius(), getQualityOfFit(), and Brain::triggerTest().
|
inline |
Definition at line 225 of file Model.h.
References m_Filename, and setHLNode().
Referenced by Brain::triggerTest(), and MStructure::write().
|
inline |
Definition at line 196 of file Model.h.
References m_Flags.
Referenced by Searcher::add(), and Brain::triggerTest().
float Model::getFullLength | ( | ) | const |
|
inline |
Returns ID of highlighted node. Value is -1 if none is selected.
Definition at line 231 of file Model.h.
References adjMat(), attachSensorColl(), connectNodes(), createByAdjMat(), getSelectedNodesN(), m_HLNode, rebuildIndexTables(), removeByAdjMat(), removeEdges(), removeNode(), selMaskMat(), and Node::ST_SELECT.
Referenced by Brain::triggerTest().
|
inline |
|
inline |
float Model::getLengthRatio | ( | ) | const |
relation of overall edge length by overall rest length sum
Definition at line 968 of file Model.cpp.
References edges.
Referenced by adaptProportion(), getDeformation(), and getMaxRadius().
float Model::getLengthVariation | ( | ) | const |
mean squared difference from restlength normalized by restlength sum
Definition at line 984 of file Model.cpp.
References edges, and dmutil::sqrt().
Referenced by getMaxRadius().
float Model::getLiveliness | ( | ) | const |
Definition at line 1222 of file Model.cpp.
References edges, getCenter(), m_Liveliness, m_PCFlags, nodes, PC_LIVE, and dmutil::sqrt().
Referenced by MStructure::buildMasterModel(), and setID().
float Model::getMaxRadius | ( | const Point & | center | ) | const |
Returns the maximum radius from the centroid.
Definition at line 1032 of file Model.cpp.
References nodes, and dmutil::sqrt().
|
inline |
Definition at line 135 of file Model.h.
References adaptProportion(), adaptRestLength(), adaptRestLengthSel(), addImageForces(), addTorque(), calculateDerivatives(), calculateForces(), getCenter(), getDeformation(), getEdgeSensorFit(), getLengthRatio(), getLengthVariation(), getMaxRadius(), getSensorFit(), mergeSensorCollection(), NULL, prepareTorque(), resetForces(), scale(), scaleSel(), and updateParticles().
Referenced by getMaxRadius(), and getStdRadius().
|
inline |
Definition at line 81 of file Model.h.
References m_Name.
Referenced by Brain::Brain(), Searcher::evolve(), Winner::setModel(), Searcher::triggerTest(), and Brain::triggerTest().
|
inline |
Definition at line 78 of file Model.h.
References edges, getNodeAngle(), and setName().
Referenced by MStructure::buildMasterModel(), and Brain::triggerTest().
|
inline |
Definition at line 77 of file Model.h.
References nodes.
Referenced by adjMat(), MStructure::buildAllStats(), Searcher::buildBins(), createByAdjMat(), distance(), Searcher::distribute(), getDirNode(), removeByAdjMat(), removeNode(), selMaskMat(), setHLNode(), MStructure::showStats(), Brain::triggerTest(), and updateParticles().
|
inline |
Definition at line 74 of file Model.h.
References nodes.
Referenced by MStructure::addExpectation(), MStructure::buildAllStats(), getDirNode(), setHLNode(), MStructure::showStats(), and Brain::triggerTest().
float Model::getNodeAngle | ( | const Node & | n | ) | const |
Definition at line 605 of file Model.cpp.
References Point2D::angle(), Node::edges, and edges.
Referenced by addTorque(), getNEdges(), and prepareTorque().
const PropVec & Model::getProperties | ( | ) | const |
Definition at line 1263 of file Model.cpp.
References getCenter(), getDirection(), getStdRadius(), m_PCFlags, m_PropVec, PC_CENTER, PC_DIR, PC_PVEC, and PC_SCALE.
Referenced by MStructure::addExpectation(), Searcher::buildBins(), Searcher::cleanFlags(), distance(), Searcher::distribute(), Brain::doCommand(), getDataScale(), getPropertiesMM(), main(), Searcher::mutate(), MStructure::setRefModel(), and Brain::triggerTest().
PropVec Model::getPropertiesMM | ( | ) | const |
return property vector using millimeter scale
Definition at line 1274 of file Model.cpp.
References convertPropToMM(), and getProperties().
Referenced by getDataScale(), and MStructure::rebuildExpMap().
float Model::getQualityOfFit | ( | ) | const |
Definition at line 1204 of file Model.cpp.
References dmutil::abs(), edges, getDeformation(), getEdgeSensorFit(), getSensorFit(), m_Dataset, m_PCFlags, m_QOF, m_ShapeWeight, nodes, and PC_QOF.
Referenced by MStructure::addExpectation(), Searcher::cleanFlags(), Searcher::distribute(), Brain::distributeModel(), Brain::drawAllModels(), Searcher::evolve(), Brain::evolve(), StructTable::findBestConnection(), std::greater< Model * >::operator()(), StructPath::print(), setID(), and Brain::triggerTest().
dword Model::getSelectedNodesN | ( | dword | state = Node::ST_SELECT | ) | const |
get number of selected nodes
Definition at line 1334 of file Model.cpp.
References nodes.
Referenced by getHLNode(), and Brain::triggerTest().
|
inline |
Definition at line 168 of file Model.h.
References createEdgeSensors(), getCenter(), getDirection(), getDirNode(), m_Sensors, and reattachSensors().
Referenced by Brain::triggerTest().
get average sensor value
Definition at line 1173 of file Model.cpp.
References nodes.
Referenced by getMaxRadius(), getQualityOfFit(), and Brain::triggerTest().
float Model::getStdRadius | ( | const Point & | center | ) | const |
Returns mean squared distance from centroid.
Definition at line 1018 of file Model.cpp.
References getPropScale(), m_PCFlags, m_PropVec, nodes, PC_SCALE, setPropScale(), and dmutil::sqrt().
Referenced by distance(), Brain::distributeModel(), Brain::evolve(), Searcher::mutate(), and Brain::setupSearch().
|
inline |
Definition at line 132 of file Model.h.
References getCenter(), getMaxRadius(), and getStdRadius().
Referenced by adaptProperties(), createEdgeSensors(), distance(), getProperties(), getStdRadius(), and rotate().
|
inline |
Definition at line 220 of file Model.h.
References m_PCFlags.
Referenced by rotate(), scale(), setDirNode(), setShapeWeight(), translate(), and updateParticles().
|
inline |
|
inline |
|
inline |
Definition at line 1312 of file Model.cpp.
References hasFlags(), m_ID, m_InstCount, m_TimeStamp, setFlags(), ST_DEL, and ST_NODEL.
Referenced by setInstCount().
void Model::mergeSensorCollection | ( | SensorCollection * | sensors | ) |
Definition at line 596 of file Model.cpp.
References m_Sensors, SensorCollection::merge(), and NULL.
Referenced by getMaxRadius(), and MStructure::MStructure().
Definition at line 1108 of file Model.cpp.
References nodes, and dmutil::sqrt().
Referenced by getDataScale(), and Brain::triggerTest().
|
inline |
Definition at line 50 of file Model.cpp.
References attachSensorColl(), edges, m_CRC, m_Dataset, m_DirNodeInd, m_Filename, m_Flags, m_HLNode, m_ID, m_InstCount, m_Liveliness, m_Name, m_PCFlags, m_ppmm, m_PropVec, m_QOF, m_SensorFile, m_Sensors, m_ShapeWeight, m_TimeStamp, nodes, and phys.
Referenced by Model(), and setID().
void Model::prepareTorque | ( | ) |
Definition at line 713 of file Model.cpp.
References getNodeAngle(), and nodes.
Referenced by connectNodes(), freeze(), getMaxRadius(), operator>>(), removeEdges(), removeNode(), and Brain::triggerTest().
void Model::push | ( | const Point & | t | ) |
Definition at line 931 of file Model.cpp.
References nodes.
Referenced by Searcher::mutate(), and setID().
void Model::pushRotate | ( | const Point & | c, |
float | angle | ||
) |
Definition at line 954 of file Model.cpp.
References nodes.
Referenced by Searcher::mutate(), and rotate().
bool Model::readEdge | ( | ParseFile & | is | ) |
read edge from stream
Definition at line 167 of file Model.cpp.
References addEdge(), Edge::dampingconstant, edges, Edge::edgesensor, ParseFile::getKey(), ParseFile::getNextLine(), ParseFile::getValue(), nodes, ParseFile::pushLine(), Edge::restlength, ParseFile::setParseError(), and Edge::springconstant.
Referenced by operator>>(), and setID().
bool Model::readFile | ( | const char * | filename, |
bool | fullread = true |
||
) |
Read geometry from file. See operator>>() for further details.
Definition at line 365 of file Model.cpp.
References IOException::getMessage(), and reset().
Referenced by Brain::doCommand(), MStructure::getRefModel(), Brain::loadModel(), main(), MStructure::read(), and setID().
bool Model::readNode | ( | ParseFile & | is | ) |
read node from stream
Definition at line 210 of file Model.cpp.
References addNode(), Node::attachSensor(), ParseFile::getKey(), ParseFile::getNextLine(), SensorCollection::getSensor(), ParseFile::getValue(), getZeroSensor(), m_Sensors, Node::mass, phys, ParseFile::pushLine(), ParseFile::setParseError(), Point2D::x, and Point2D::y.
Referenced by operator>>(), and setID().
bool Model::readParameter | ( | ParseFile & | is | ) |
read model parameters
Definition at line 263 of file Model.cpp.
References ParticleParam::damping, ParseFile::getKey(), ParseFile::getNextLine(), ParseFile::getValue(), ParticleParam::gravitational, ParticleParam::imgforce, m_DirNodeInd, m_ppmm, ParticleParam::mass, phys, ParseFile::pushLine(), setName(), ParticleParam::springconst, ParticleParam::torque, and ParticleParam::viscousdrag.
Referenced by operator>>(), and setID().
bool Model::readSensor | ( | ParseFile & | is | ) |
read sensor from stream
Definition at line 244 of file Model.cpp.
References SensorCollection::addSensor(), ParseFile::getKey(), ParseFile::getNextLine(), ParseFile::getPath(), ParseFile::getValue(), m_SensorFile, m_Sensors, ParseFile::pushLine(), and SensorCollection::readSensor().
Referenced by operator>>(), and setID().
void Model::reattachSensors | ( | ) |
get sensors from sensor collection
Definition at line 616 of file Model.cpp.
References SensorCollection::getSensor(), m_Sensors, and nodes.
Referenced by getSensorCollection(), Searcher::reattachSensors(), and Brain::triggerTest().
|
protected |
rebuild cross indexing between nodes and edges
Definition at line 527 of file Model.cpp.
Referenced by getHLNode(), removeByAdjMat(), and removeNode().
remove edged not mentioned in (non-directional) adjacency matrix
remove edged mentioned in (non-directional) adjacency matrix
Definition at line 447 of file Model.cpp.
References DMatrix< T >::at(), edges, getNNodes(), rebuildIndexTables(), DMatrix< T >::sizeX(), and DMatrix< T >::sizeY().
Referenced by getHLNode(), and removeEdges().
dword Model::removeEdges | ( | ) |
Remove edges between selected nodes.
Definition at line 498 of file Model.cpp.
References adjMat(), prepareTorque(), removeByAdjMat(), and selMaskMat().
Referenced by getHLNode(), and Brain::triggerTest().
void Model::removeNode | ( | int | nid | ) |
Removes a node and its adjacent edges.
Definition at line 508 of file Model.cpp.
References edges, getNNodes(), m_DirNodeInd, m_HLNode, nodes, prepareTorque(), and rebuildIndexTables().
Referenced by getHLNode(), and Brain::triggerTest().
void Model::reset | ( | ) |
reset all model information (including geometry)
Definition at line 103 of file Model.cpp.
References __SHAPEWEIGHT, clear(), ParticleParam::gravitational, m_Filename, m_Flags, m_InstCount, m_PCFlags, m_ShapeWeight, m_TimeStamp, PC_NOTHING, phys, setName(), and ParticleParam::viscousdrag.
Referenced by operator bool(), operator>>(), and readFile().
void Model::resetForces | ( | ) |
Definition at line 640 of file Model.cpp.
References nodes.
Referenced by getMaxRadius(), and updateParticles().
void Model::rotate | ( | float | angle, |
const Point & | c | ||
) |
Definition at line 946 of file Model.cpp.
References invalidatePC(), nodes, PC_CENTER, PC_DIR, PC_STATS, and Point2D::rotate().
Referenced by adaptProperties(), Brain::distributeModel(), rotate(), setID(), and Brain::triggerTest().
|
inline |
Definition at line 124 of file Model.h.
References attract(), getCenter(), getFullLength(), getStdRadius(), m_PCFlags, PC_CENTER, pushRotate(), and rotate().
void Model::scale | ( | float | factor, |
bool | movepoints = false |
||
) |
multiply all rest lengths by factor
Definition at line 1140 of file Model.cpp.
References edges, getCenter(), invalidatePC(), nodes, PC_SCALE, and PC_STATS.
Referenced by adaptDataScale(), adaptProperties(), MStructure::buildMasterModel(), Brain::distributeModel(), getDeformation(), getMaxRadius(), and Brain::triggerTest().
void Model::scaleSel | ( | float | factor, |
const DMatrixf & | selm | ||
) |
multiply all rest lengths of selected edges by factor
Definition at line 1156 of file Model.cpp.
References DMatrix< T >::at(), and edges.
Referenced by getMaxRadius(), and Brain::triggerTest().
DMatrixf Model::selMaskMat | ( | ) | const |
compute mask matrix of selected nodes
Definition at line 431 of file Model.cpp.
References getNNodes(), DMatrix< T >::min(), nodes, DMatrix< T >::setCol(), DMatrix< T >::setRow(), and Node::ST_SELECT.
Referenced by connectNodes(), getHLNode(), removeEdges(), and Brain::triggerTest().
|
inline |
Definition at line 177 of file Model.h.
References invalidatePC(), m_DirNodeInd, and PC_DIR.
Referenced by Brain::doCommand().
Definition at line 198 of file Model.h.
References m_Flags.
Referenced by mergeModel(), and StructPath::protectWinners().
void Model::setHLNode | ( | int | hlnode | ) |
Set ID of highlighted node. Pass invalid node id (e.g. -1) to have none highlighted.
Definition at line 405 of file Model.cpp.
References Node::disableState(), Node::enableState(), getNNodes(), getNode(), m_HLNode, and Node::ST_HIGHLIGHT.
Referenced by getFilename(), and Brain::triggerTest().
|
inline |
Definition at line 84 of file Model.h.
References addNoise(), attachDataset(), draw(), drawPS(), freeze(), getLiveliness(), getQualityOfFit(), m_ID, operator<<, operator=(), operator>>, push(), readEdge(), readFile(), readNode(), readParameter(), readSensor(), rotate(), translate(), and writeFile().
Referenced by Searcher::add().
|
inline |
Definition at line 223 of file Model.h.
References m_InstCount, and mergeModel().
Referenced by Searcher::add().
|
inline |
void Model::setName | ( | const std::string & | name | ) |
Definition at line 399 of file Model.cpp.
References CRC(), m_CRC, and m_Name.
Referenced by getNEdges(), Model(), operator>>(), readParameter(), MStructure::rebuildExpMap(), and reset().
|
inline |
|
inline |
Definition at line 201 of file Model.h.
References adaptDataScale(), invalidatePC(), m_ShapeWeight, and PC_QOF.
Referenced by Brain::distributeModel(), and Brain::triggerTest().
|
inline |
void Model::translate | ( | const Point & | t | ) |
Definition at line 923 of file Model.cpp.
References invalidatePC(), nodes, PC_CENTER, and PC_STATS.
Referenced by adaptProperties(), Brain::distributeModel(), Brain::evolve(), setID(), and Brain::triggerTest().
Definition at line 199 of file Model.h.
References m_Flags.
Referenced by StructPath::unprotectWinners().
void Model::updateParticles | ( | float | dt, |
int | method = 0 |
||
) |
Definition at line 752 of file Model.cpp.
References addTorque(), calculateDerivatives(), calculateForces(), getNNodes(), getSearchPara(), invalidatePC(), SearcherParams::m_ParaSolver, nodes, and resetForces().
Referenced by MStructure::buildMasterModel(), and getMaxRadius().
bool Model::writeFile | ( | const char * | filename | ) | const |
Write geometry to file.
Definition at line 381 of file Model.cpp.
References IOException::getMessage(), and phys.
Referenced by setID(), MStructure::setRefModel(), and Brain::triggerTest().
|
friend |
Read geometry from stream.
Definition at line 338 of file Model.cpp.
Referenced by setID().
Read complete geometry from input stream.
#example v 1 1 v 2 2 e 1 2
Definition at line 299 of file Model.cpp.
Referenced by setID().
|
protected |
indexed list of edges
Definition at line 263 of file Model.h.
Referenced by adaptProportion(), adaptRestLength(), adaptRestLengthSel(), addEdge(), addNoise(), addTorque(), adjMat(), calculateForces(), clear(), createEdgeSensors(), draw(), freeze(), getDeformation(), getEdge(), getEdgeSensorFit(), getFullLength(), getLengthRatio(), getLengthVariation(), getLiveliness(), getNEdges(), getNodeAngle(), getQualityOfFit(), operator<<(), operator=(), readEdge(), rebuildIndexTables(), removeByAdjMat(), removeNode(), scale(), and scaleSel().
|
protected |
Definition at line 271 of file Model.h.
Referenced by getCRC(), operator=(), and setName().
|
protected |
Definition at line 265 of file Model.h.
Referenced by adaptDataScale(), addImageForces(), addTorque(), attachDataset(), convertPointFromMM(), convertPointToMM(), getQualityOfFit(), and operator=().
|
mutableprotected |
Definition at line 273 of file Model.h.
Referenced by clear(), getDirNode(), Model(), operator<<(), operator=(), readParameter(), removeNode(), and setDirNode().
|
protected |
Definition at line 281 of file Model.h.
Referenced by getFilename(), operator<<(), operator=(), operator>>(), and reset().
|
protected |
Definition at line 269 of file Model.h.
Referenced by getFlags(), hasFlags(), isLooser(), isOldState(), isWinner(), operator=(), reset(), setFlags(), setLooser(), setOldState(), setWinner(), switchFlags(), and unsetFlags().
|
mutableprotected |
Definition at line 283 of file Model.h.
Referenced by getHLNode(), operator=(), removeNode(), and setHLNode().
|
mutableprotected |
Definition at line 284 of file Model.h.
Referenced by getID(), mergeModel(), operator=(), and setID().
|
protected |
number of merged instances
Definition at line 280 of file Model.h.
Referenced by getInstCount(), mergeModel(), operator=(), reset(), and setInstCount().
|
mutableprotected |
Definition at line 277 of file Model.h.
Referenced by getLiveliness(), and operator=().
|
protected |
Definition at line 270 of file Model.h.
Referenced by getName(), operator<<(), operator=(), and setName().
|
mutableprotected |
Definition at line 274 of file Model.h.
Referenced by getCenter(), getDirection(), getLiveliness(), getProperties(), getQualityOfFit(), getStdRadius(), invalidatePC(), operator=(), reset(), and rotate().
|
protected |
Definition at line 272 of file Model.h.
Referenced by adaptDataScale(), convertPointFromMM(), convertPointToMM(), convertPropFromMM(), convertPropToMM(), getDataScale(), Model(), operator<<(), operator=(), operator>>(), and readParameter().
|
mutableprotected |
Definition at line 275 of file Model.h.
Referenced by getCenter(), getDirection(), getProperties(), getStdRadius(), and operator=().
|
mutableprotected |
Definition at line 276 of file Model.h.
Referenced by getQualityOfFit(), and operator=().
|
protected |
Definition at line 267 of file Model.h.
Referenced by operator<<(), operator=(), and readSensor().
|
protected |
Definition at line 266 of file Model.h.
Referenced by attachDataset(), attachSensorColl(), getSensorCollection(), mergeSensorCollection(), Model(), operator<<(), operator=(), readNode(), readSensor(), and reattachSensors().
|
protected |
Definition at line 268 of file Model.h.
Referenced by getQualityOfFit(), Model(), operator=(), reset(), and setShapeWeight().
float Model::m_TimeStamp |
time stamps (see. TTimeStamp)
Definition at line 259 of file Model.h.
Referenced by Searcher::add(), Searcher::cleanFlags(), Searcher::getGeneration(), mergeModel(), operator=(), and reset().
|
protected |
indexed list of nodes
Definition at line 262 of file Model.h.
Referenced by adaptProperties(), addEdge(), addImageForces(), addNode(), addNoise(), addTorque(), attract(), calculateDerivatives(), calculateForces(), clear(), distance(), draw(), getCenter(), getDirection(), getDirNode(), getLiveliness(), getMaxRadius(), getNNodes(), getNode(), getQualityOfFit(), getSelectedNodesN(), getSensorFit(), getStdRadius(), nearestNode(), operator bool(), operator<<(), operator=(), prepareTorque(), push(), pushRotate(), readEdge(), reattachSensors(), rebuildIndexTables(), removeNode(), resetForces(), rotate(), scale(), selMaskMat(), translate(), and updateParticles().
ParticleParam Model::phys |
physical parameter set
Definition at line 257 of file Model.h.
Referenced by addEdge(), addTorque(), MStructure::buildMasterModel(), calculateForces(), Edge::Edge(), Model(), Node::Node(), operator<<(), operator=(), operator>>(), readNode(), readParameter(), reset(), Brain::triggerTest(), and writeFile().