void XYStateVariables::decode(Variables *var, RawVariables *raw) { for (RawVariables::iterator ra = raw->begin(); ra != raw->end(); ++ra) { Models models = find<Model*>(ra->modelPath); int noOfVariables = 0; for (Models::iterator mo = models.begin(); mo != models.end(); ++mo) { if (ra->stateName == "*") { for (Model::States::const_iterator st = (*mo)->states().begin(); st != (*mo)->states().end(); ++st) { Identifier stateId = st.key(); Variable v = {ra->variableName, stateId.key(), *mo, st.value()}; var->append(v); ++noOfVariables; } } else { const double *statePtr = (*mo)->statePtr(ra->stateName); if (statePtr) { Variable v = {ra->variableName, ra->stateName, *mo, statePtr}; var->append(v); ++noOfVariables; } } } if (noOfVariables == 0) throw Exception("Could not find variable: " + rawVariableAsText(*ra)); } }
void realise(){ if ( --m_unrealised == 0 ) { globalOutputStream() << "searching vfs directory " << makeQuoted( "def" ) << " for *.def\n"; GlobalFileSystem().forEachFile( "def/", "def", makeCallbackF(EntityClassDoom3_loadFile) ); { for ( Models::iterator i = g_models.begin(); i != g_models.end(); ++i ) { Model_resolveInheritance( ( *i ).first.c_str(), ( *i ).second ); } } { for ( EntityClasses::iterator i = g_EntityClassDoom3_classes.begin(); i != g_EntityClassDoom3_classes.end(); ++i ) { EntityClass_resolveInheritance( ( *i ).second ); if ( !string_empty( ( *i ).second->m_modelpath.c_str() ) ) { Models::iterator j = g_models.find( ( *i ).second->m_modelpath ); if ( j != g_models.end() ) { ( *i ).second->m_modelpath = ( *j ).second.m_mesh; ( *i ).second->m_skin = ( *j ).second.m_skin; } } eclass_capture_state( ( *i ).second ); StringOutputStream usage( 256 ); usage << "-------- NOTES --------\n"; if ( !string_empty( ( *i ).second->m_comments.c_str() ) ) { usage << ( *i ).second->m_comments.c_str() << "\n"; } usage << "\n-------- KEYS --------\n"; for ( EntityClassAttributes::iterator j = ( *i ).second->m_attributes.begin(); j != ( *i ).second->m_attributes.end(); ++j ) { const char* name = EntityClassAttributePair_getName( *j ); const char* description = EntityClassAttributePair_getDescription( *j ); if ( !string_equal( name, description ) ) { usage << EntityClassAttributePair_getName( *j ) << " : " << EntityClassAttributePair_getDescription( *j ) << "\n"; } } ( *i ).second->m_comments = usage.c_str(); } } m_observers.realise(); } }
void GraphGenerator::generateDot() { QFile f(_dotFilePath); if (!f.open(QIODevice::Text | QIODevice::WriteOnly)) throw UniSim::Exception("Could not open output file to draw graph:\n'" + _dotFilePath + "'"); _nodeNumber = 0; f.write("digraph G {size=\"16,24\";graph[rankdir=LR];\n"); Models models = seekChildren<Model*>("*", _simulation); for (Models::const_iterator mo = models.begin(); mo != models.end(); ++mo) { writeModel(&f, _simulation, *mo, 0); } f.write("\n}\n"); }