|
Structural deformable models
|
#include <Brain.h>


Public Types | |
| enum | RunWhat { DO_ANIMATE, DO_NOTHING, DO_ANALYSIS, DO_LAST } |
| some options for run(whatsup) More... | |
Public Member Functions | |
| Brain () | |
| ~Brain () | |
| bool | load (const char *bfile) |
| bool | loadModel (const char *filename) |
| bool | loadData (const char *filename, dword ppmm=0) |
| bool | loadDB (const char *filename) |
| bool | loadDBSelector (const char *filename) |
| bool | loadSpecies (const Species &spec) |
| const Model & | getModel () |
| const Dataset & | getData () const |
| Dataset & | getSensorData () |
| void | attachBrowseData () |
| void | drawAllModels () const |
| bool | triggerTest (int mx, int my, int what=0) |
| bool | doCommand (const std::string &command, const std::string &value, int mx=0, int my=0) |
| bool | isDone () const |
| void | run (int whatsup, void *data) |
| virtual from vuThread More... | |
| dword | duplicateState (const Model *model=NULL) |
| bool | switchState (dword newstate) |
| void | killState (dword state) |
| void | killAllStates () |
| void | killCurrentState () |
| void | toggleUpdateForAll (bool onoff=true) |
| void | evolve (float dt) |
| void | findWinners () |
| const SensorCollection & | getSensors () const |
| SensorCollection & | getSensors () |
| void | getQualityRange (float &lqof, float &hqof, float shapeweight=-1) const |
| int | distributeModel (const Model &model, int n=-1, float qth=0, bool count=false) |
| bool | changeModel (const std::string &mname) |
| bool | mergeInstances () |
| template<class Iter > | |
| dword | getAllModels (Iter iter) |
| vuMutex & | getGeomMutex () |
Public Member Functions inherited from vuThread | |
| virtual | ~vuThread () |
| Virtual destructor (doing nothing) More... | |
| bool | startThread (int whatsup, void *data=NULL) |
| void | stopThread () |
Protected Types | |
| enum | SearchWhat { SW_UB, SW_LB, SW_RESET, SW_SET, SW_SPREAD } |
Protected Member Functions | |
| int | getBindex (int bx, int by, bool &culled=*((bool *) NULL)) |
| void | setupSearch (enum SearchWhat what=SW_RESET, const PropVec &prop=PropVec()) |
Protected Attributes | |
| dataset_ptr | m_Data |
| dataset_ptr | m_BrowseData |
| SensorCollection | m_Sensors |
| Model * | m_Geom |
| std::vector< Model * > * | m_CStates |
| std::map< std::string, Model * > | m_Prototypes |
| std::map< std::string, std::vector< Model * > > | m_Instances |
| std::string | m_CurPrototype |
| dword | m_CurState |
| SpeciesDB | m_DB |
| DBSelector | m_DBSelector |
| Species | m_CSpecies |
| float | m_TimeStep |
| float | m_TimeScale |
| bool | m_UpdateAllModels |
| vuMutex | m_GeomMutex |
| vuMutex | m_DataMutex |
| vuMutex | m_RunMutex [DO_LAST] |
| bool | m_ThreadActive [DO_LAST] |
| bool | m_Done |
| bool | m_DesignMode |
| bool | m_ImmediateData |
| bool | m_DrawOwnState |
| Searcher | m_Search |
| std::list< Model > | m_Winners |
| StructTable | m_SModel |
Additional Inherited Members | |
Static Public Member Functions inherited from vuThread | |
| static void | usleep (unsigned long ms) |
| sleep for n microseconds (!!not yet implemented for win32) More... | |
| enum Brain::RunWhat |
some options for run(whatsup)
| Enumerator | |
|---|---|
| DO_ANIMATE | |
| DO_NOTHING | |
| DO_ANALYSIS | |
| DO_LAST | |
|
protected |
| Enumerator | |
|---|---|
| SW_UB | |
| SW_LB | |
| SW_RESET | |
| SW_SET | |
| SW_SPREAD | |
Definition at line 85 of file Brain.h.
| Brain::Brain | ( | ) |
Definition at line 27 of file Brain.cpp.
References SensorCollection::addSensor(), DO_ANIMATE, DO_LAST, Model::getName(), m_BrowseData, m_CStates, m_CurPrototype, m_CurState, m_Data, m_DesignMode, m_Done, m_Geom, m_ImmediateData, m_Sensors, m_ThreadActive, and vuThread::startThread().
| Brain::~Brain | ( | ) |
Definition at line 46 of file Brain.cpp.
References DO_LAST, vuMutex::lock(), m_CStates, m_GeomMutex, m_RunMutex, m_ThreadActive, NULL, and vuMutex::unlock().
| void Brain::attachBrowseData | ( | ) |
Definition at line 300 of file Brain.cpp.
References StructTable::adaptDataScale(), getAllModels(), m_BrowseData, m_Data, m_SModel, and setupSearch().
Referenced by getModel(), loadData(), run(), and triggerTest().
| bool Brain::changeModel | ( | const std::string & | mname | ) |
change container to prototype of name mname
Definition at line 231 of file Brain.cpp.
References m_CStates, m_CurPrototype, m_Instances, and switchState().
Referenced by getSensors(), and mergeInstances().
| int Brain::distributeModel | ( | const Model & | model, |
| int | n = -1, |
||
| float | qth = 0, |
||
| bool | count = false |
||
| ) |
Definition at line 1299 of file Brain.cpp.
References __SHAPEWEIGHT, duplicateState(), fgauss01(), frand, Model::getCenter(), Model::getQualityOfFit(), Model::getStdRadius(), killCurrentState(), m_CurState, m_Data, m_Geom, M_PI, Model::rotate(), Model::scale(), Model::setShapeWeight(), switchState(), and Model::translate().
Referenced by getSensors(), and triggerTest().
| bool Brain::doCommand | ( | const std::string & | command, |
| const std::string & | value, | ||
| int | mx = 0, |
||
| int | my = 0 |
||
| ) |
Definition at line 1150 of file Brain.cpp.
References dmutil::abs(), MStructure::buildAllStats(), Species::CMP_GREATER, DO_ANALYSIS, DUMP, fromString(), DBSelector::getCurSpecies(), Model::getDirNode(), SpeciesDB::getFilename(), Species::getFlagString(), Node::getIndex(), MStructure::getInfoFilename(), StructTable::getNextStruct(), Model::getProperties(), MStructure::getRefModelIDs(), Species::getScale(), getSearchPara(), Species::id, loadSpecies(), m_BrowseData, m_CSpecies, m_DB, m_DBSelector, m_Geom, m_SModel, DBSelector::nextSelection(), Model::readFile(), Species::readFlagString(), SpeciesDB::select(), Model::setDirNode(), MStructure::setRefModel(), MStructure::setRefProp(), vuThread::startThread(), toString(), and SearcherParams::write().
Referenced by getModel(), and triggerTest().
| void Brain::drawAllModels | ( | ) | const |
Definition at line 1344 of file Brain.cpp.
References Searcher::draw(), StructTable::draw(), Model::draw(), StructTable::getIPaths(), Model::getQualityOfFit(), getQualityRange(), StructTable::getShownIP(), m_BrowseData, m_CStates, m_Data, m_DataMutex, m_DesignMode, m_DrawOwnState, m_Geom, m_GeomMutex, m_Search, m_SModel, sglBitmapString(), sglBitmapStringOutlined(), Point2D::x, and Point2D::y.
Referenced by getModel().
duplicate state of current model
Definition at line 1267 of file Brain.cpp.
References m_CStates, m_CurState, and m_Geom.
Referenced by distributeModel(), evolve(), and triggerTest().
| void Brain::evolve | ( | float | dt | ) |
Definition at line 1424 of file Brain.cpp.
References duplicateState(), Searcher::evolve(), frand, Model::getCenter(), Model::getQualityOfFit(), getQualityRange(), getSearchPara(), Model::getStdRadius(), killState(), m_CStates, m_CurState, m_Data, m_Done, m_Geom, m_Search, m_SModel, Searcher::step(), StructTable::stepSearch(), switchState(), and Model::translate().
Referenced by run(), and toggleUpdateForAll().
| void Brain::findWinners | ( | ) |
Referenced by toggleUpdateForAll().
|
inline |
Definition at line 116 of file Brain.h.
References m_CStates.
Referenced by attachBrowseData(), and getSensors().
|
protected |
Referenced by getGeomMutex().
| const Dataset & Brain::getData | ( | ) | const |
|
inline |
|
inline |
Definition at line 39 of file Brain.h.
References attachBrowseData(), doCommand(), drawAllModels(), getData(), getSensorData(), m_Geom, and triggerTest().
| void Brain::getQualityRange | ( | float & | lqof, |
| float & | hqof, | ||
| float | shapeweight = -1 |
||
| ) | const |
Definition at line 1506 of file Brain.cpp.
References m_CStates.
Referenced by drawAllModels(), evolve(), getSensors(), and triggerTest().
| Dataset & Brain::getSensorData | ( | ) |
|
inline |
|
inline |
Definition at line 71 of file Brain.h.
References changeModel(), distributeModel(), getAllModels(), getQualityRange(), m_Sensors, and mergeInstances().
| void Brain::killAllStates | ( | ) |
Definition at line 1291 of file Brain.cpp.
References killState(), m_CStates, and m_CurState.
Referenced by triggerTest().
|
inline |
Definition at line 63 of file Brain.h.
References killState(), and m_CurState.
Referenced by distributeModel(), and triggerTest().
| void Brain::killState | ( | dword | state | ) |
Definition at line 1280 of file Brain.cpp.
References m_CStates, m_CurState, and switchState().
Referenced by evolve(), killAllStates(), killCurrentState(), and triggerTest().
| bool Brain::load | ( | const char * | bfile | ) |
Definition at line 87 of file Brain.cpp.
References ParseFile::getErrorMsg(), ParseFile::getKey(), MStructure::getModel(), MStructure::getName(), ParseFile::getNextLine(), StructTable::getNextStruct(), ParseFile::getPath(), MStructure::getRefModel(), getSearchPara(), ParseFile::getValue(), Species::id, StructTable::load(), loadData(), loadDB(), loadDBSelector(), loadModel(), m_CSpecies, m_Geom, m_GeomMutex, m_Sensors, m_SModel, SearcherParams::read(), Species::reset(), ParseFile::setParseError(), SensorCollection::updateModels(), and SearcherParams::write().
| bool Brain::loadData | ( | const char * | filename, |
| dword | ppmm = 0 |
||
| ) |
Definition at line 288 of file Brain.cpp.
References attachBrowseData(), Species::getScale(), m_BrowseData, m_CSpecies, m_Data, m_DataMutex, and m_ImmediateData.
Referenced by load(), and loadSpecies().
| bool Brain::loadDB | ( | const char * | filename | ) |
Definition at line 195 of file Brain.cpp.
References DBSelector::getCurSpecies(), SpeciesDB::load(), loadSpecies(), m_DB, m_DBSelector, and DBSelector::update().
Referenced by load().
| bool Brain::loadDBSelector | ( | const char * | filename | ) |
Definition at line 203 of file Brain.cpp.
References DBSelector::getCurSpecies(), DBSelector::load(), loadSpecies(), and m_DBSelector.
Referenced by load().
| bool Brain::loadModel | ( | const char * | filename | ) |
Definition at line 163 of file Brain.cpp.
References m_Geom, m_GeomMutex, m_Sensors, Model::readFile(), setupSearch(), and SensorCollection::updateModels().
Referenced by load(), and triggerTest().
| bool Brain::loadSpecies | ( | const Species & | spec | ) |
Definition at line 210 of file Brain.cpp.
References SpeciesDB::getDirectory(), Species::getFlagString(), Species::getScale(), loadData(), m_CSpecies, m_DB, setStatusText(), and setTitle().
Referenced by doCommand(), loadDB(), loadDBSelector(), run(), and triggerTest().
| bool Brain::mergeInstances | ( | ) |
create a new instance 'all' containing copies of all instances.
Definition at line 261 of file Brain.cpp.
References changeModel(), m_CStates, m_Instances, MERGENAME, and switchState().
Referenced by getSensors().
|
virtual |
virtual from vuThread
Implements vuThread.
Definition at line 334 of file Brain.cpp.
References attachBrowseData(), CHECK_THREAD, DO_ANALYSIS, DO_ANIMATE, DO_NOTHING, evolve(), EXIT_THREAD, StructTable::getBestInterpretation(), DBSelector::getCurSpecies(), StructTable::getIPaths(), getMilliSeconds(), StructTable::getNextStruct(), Species::hasFlag(), Species::id, loadSpecies(), vuMutex::lock(), m_CSpecies, m_CStates, m_Data, m_DataMutex, m_DBSelector, m_GeomMutex, m_RunMutex, m_SModel, m_ThreadActive, m_TimeScale, m_TimeStep, m_UpdateAllModels, DBSelector::nextSelection(), nowticks, StructTable::searchDone(), Species::SEL5, StructTable::startSearch(), vuMutex::unlock(), and vuThread::usleep().
|
protected |
Definition at line 1520 of file Brain.cpp.
References ExpectationMap::add(), ExpectationMap::correctLBUB(), DUMP, Searcher::getExpectationMap(), EMDRect::getLB(), getPropScale(), Model::getStdRadius(), EMDRect::getUB(), m_Data, m_Geom, M_PI, m_Search, Searcher::setExpectationMap(), EMDRect::setLB(), setPropDir(), setPropPos(), setPropScale(), ExpectationMap::setRepresentative(), EMDRect::setUB(), SW_LB, SW_RESET, SW_SET, SW_SPREAD, and SW_UB.
Referenced by attachBrowseData(), loadModel(), and triggerTest().
| bool Brain::switchState | ( | dword | newstate | ) |
Definition at line 1255 of file Brain.cpp.
References m_CurState, and m_Geom.
Referenced by changeModel(), distributeModel(), evolve(), killState(), mergeInstances(), and triggerTest().
|
inline |
Definition at line 64 of file Brain.h.
References evolve(), findWinners(), and m_UpdateAllModels.
Referenced by triggerTest().
| bool Brain::triggerTest | ( | int | mx, |
| int | my, | ||
| int | what = 0 |
||
| ) |
Definition at line 442 of file Brain.cpp.
References __SHAPEWEIGHT, dmutil::abs(), Model::adaptProportion(), Edge::adaptRestLength(), Model::adaptRestLength(), Model::adaptRestLengthSel(), Model::addEdge(), Model::addNode(), Model::addNoise(), SensorCollection::addSensor(), attachBrowseData(), Node::attachSensor(), Model::connectNodes(), Model::createEdgeSensors(), Node::disableState(), distributeModel(), doCommand(), DUMP, duplicateState(), Node::enableState(), StructTable::evalRelations(), Edge::from, Model::getCenter(), DBSelector::getCurSpecies(), Model::getDeformation(), Model::getEdge(), Model::getEdgeSensorFit(), StructTable::getFilename(), Model::getFilename(), Model::getFlags(), Species::getFlagString(), Model::getHLNode(), StructTable::getIPaths(), MStructure::getModel(), MStructure::getName(), Model::getName(), Model::getNEdges(), StructTable::getNextStruct(), Model::getNNodes(), Model::getNode(), Model::getProperties(), Model::getQualityOfFit(), getQualityRange(), MStructure::getRefModel(), MStructure::getRefModelIDs(), MStructure::getRefProp(), Searcher::getRepresentative(), MStructure::getSearcher(), Model::getSelectedNodesN(), SensorCollection::getSelectedSensor(), SensorCollection::getSensor(), Model::getSensorCollection(), Model::getSensorFit(), StructTable::getShownIP(), StructTable::getStructs(), Searcher::getWinners(), Species::id, ParticleParam::imgforce, killAllStates(), killCurrentState(), killState(), StructTable::load(), loadModel(), loadSpecies(), m_BrowseData, m_CSpecies, m_CStates, m_CurState, m_DataMutex, m_DBSelector, m_DesignMode, m_Done, m_DrawOwnState, m_Geom, m_GeomMutex, M_PI, m_Prototypes, m_Search, m_Sensors, m_SModel, m_TimeScale, Model::nearestNode(), DBSelector::nextSelection(), DBSelector::nextSelector(), Model::phys, Model::prepareTorque(), Model::reattachSensors(), Model::removeEdges(), Model::removeNode(), Edge::restlength, Model::rotate(), Model::scale(), Model::scaleSel(), Species::SEL5, Model::selMaskMat(), Species::setFlag(), Model::setHLNode(), MStructure::setModel(), Node::setPos(), MStructure::setRefModel(), MStructure::setRefProp(), Model::setShapeWeight(), StructTable::setShownIP(), setStatusText(), setupSearch(), StructTable::showNextIP(), Edge::springconstant, Node::ST_SELECT, SW_LB, SW_SET, SW_SPREAD, SW_UB, switchState(), Edge::to, toggleUpdateForAll(), toString(), TRACE, Model::translate(), Searcher::triggerTest(), StructTable::triggerTest(), Species::unsetFlag(), SensorCollection::updateModels(), and Model::writeFile().
Referenced by getModel().
|
protected |
Definition at line 90 of file Brain.h.
Referenced by attachBrowseData(), Brain(), doCommand(), drawAllModels(), getData(), loadData(), and triggerTest().
|
protected |
Definition at line 100 of file Brain.h.
Referenced by doCommand(), load(), loadData(), loadSpecies(), run(), and triggerTest().
|
protected |
Definition at line 93 of file Brain.h.
Referenced by Brain(), changeModel(), drawAllModels(), duplicateState(), evolve(), getAllModels(), getQualityRange(), killAllStates(), killState(), mergeInstances(), run(), triggerTest(), and ~Brain().
|
protected |
Definition at line 96 of file Brain.h.
Referenced by Brain(), and changeModel().
|
protected |
Definition at line 97 of file Brain.h.
Referenced by Brain(), distributeModel(), duplicateState(), evolve(), killAllStates(), killCurrentState(), killState(), switchState(), and triggerTest().
|
protected |
Definition at line 89 of file Brain.h.
Referenced by attachBrowseData(), Brain(), distributeModel(), drawAllModels(), evolve(), getSensorData(), loadData(), run(), and setupSearch().
|
protected |
Definition at line 104 of file Brain.h.
Referenced by drawAllModels(), loadData(), run(), and triggerTest().
|
protected |
Definition at line 98 of file Brain.h.
Referenced by doCommand(), loadDB(), and loadSpecies().
|
protected |
Definition at line 99 of file Brain.h.
Referenced by doCommand(), loadDB(), loadDBSelector(), run(), and triggerTest().
|
protected |
Definition at line 107 of file Brain.h.
Referenced by Brain(), drawAllModels(), and triggerTest().
|
protected |
|
protected |
Definition at line 109 of file Brain.h.
Referenced by drawAllModels(), and triggerTest().
|
protected |
Definition at line 92 of file Brain.h.
Referenced by Brain(), distributeModel(), doCommand(), drawAllModels(), duplicateState(), evolve(), getModel(), load(), loadModel(), setupSearch(), switchState(), and triggerTest().
|
protected |
Definition at line 104 of file Brain.h.
Referenced by drawAllModels(), getGeomMutex(), load(), loadModel(), run(), triggerTest(), and ~Brain().
|
protected |
Definition at line 108 of file Brain.h.
Referenced by Brain(), and loadData().
|
protected |
Definition at line 95 of file Brain.h.
Referenced by changeModel(), and mergeInstances().
|
protected |
Definition at line 94 of file Brain.h.
Referenced by triggerTest().
|
protected |
Definition at line 110 of file Brain.h.
Referenced by drawAllModels(), evolve(), setupSearch(), and triggerTest().
|
protected |
Definition at line 91 of file Brain.h.
Referenced by Brain(), getSensors(), load(), loadModel(), and triggerTest().
|
protected |
Definition at line 112 of file Brain.h.
Referenced by attachBrowseData(), doCommand(), drawAllModels(), evolve(), load(), run(), and triggerTest().
|
protected |
|
protected |
Definition at line 102 of file Brain.h.
Referenced by run(), and triggerTest().
|
protected |
Definition at line 103 of file Brain.h.
Referenced by run(), and toggleUpdateForAll().
1.8.11