Simulation.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                               SOFA :: Modules                               *
00020 *                                                                             *
00021 * Authors: The SOFA Team and external contributors (see Authors.txt)          *
00022 *                                                                             *
00023 * Contact information: contact@sofa-framework.org                             *
00024 ******************************************************************************/
00025 #ifndef SOFA_SIMULATION_TREE_SIMULATION_H
00026 #define SOFA_SIMULATION_TREE_SIMULATION_H
00027 
00028 #include <sofa/simulation/common/Node.h>
00029 #include <sofa/simulation/tree/GNode.h>
00030 #include <sofa/core/objectmodel/BaseObject.h>
00031 #include <sofa/defaulttype/LaparoscopicRigidTypes.h>
00032 #include <sofa/defaulttype/Vec.h>
00033 #include <sofa/simulation/tree/xml/XML.h>
00034 namespace sofa
00035 {
00036 
00037 namespace simulation
00038 {
00039 
00040 namespace tree
00041 {
00042 
00047     class Simulation: public virtual sofa::core::objectmodel::BaseObject
00048 {
00049 private:
00051     static GNode* loadFromMemory ( const char *filename, const char *data, unsigned int size );
00053     static GNode* loadFromFile ( const char *filename );
00055     static GNode* processXML(xml::BaseElement* xml, const char *filename);
00056 public:
00063     static GNode* load(const char* filename);
00064     
00065     Simulation();
00066     virtual ~Simulation();
00067 
00069     virtual void print(Node* root);
00070         
00072         virtual void printXML(Node* root, const char* fileName=0);
00073         
00075         virtual void init(Node* root);
00076     
00078     void getInstruments( Node *node);
00079     
00081     virtual void animate(Node* root, double dt=0.0);
00082 
00084     virtual void reset(Node* root);
00085 
00087     virtual void initTextures(Node* root);
00088 
00090     virtual void updateContext(Node* root);
00091 
00093     virtual void updateVisualContext(Node* root,int FILTER=10);
00094 
00096     virtual void computeBBox(Node* root, SReal* minBBox, SReal* maxBBox);
00097 
00099     virtual void draw(Node* root);
00100 
00102     virtual void drawShadows(Node* root);
00103 
00105     virtual void unload(GNode* root);
00106 
00108     virtual void exportOBJ(Node* root, const char* filename, bool exportMTL = true);
00109         
00111     virtual void exportXML(Node* root, const char* filename);
00112         
00114     virtual void dumpState( Node* root, std::ofstream& out );
00115 
00117     virtual void initGnuplot( Node* root );
00119     virtual void exportGnuplot( Node* root, double time );
00120      
00122     Data<unsigned> numMechSteps;    
00123     Data<std::string> gnuplotDirectory;
00124 
00125     helper::vector< Node* > instruments;
00126     Data< int > instrumentInUse;
00127 };
00128 
00130 void setSimulation(Simulation*);
00131 
00135 Simulation* getSimulation();
00136 
00137 } // namespace tree
00138 
00139 } // namespace simulation
00140 
00141 } // namespace sofa
00142 
00143 #endif

Generated on Sun Nov 23 04:05:48 2008 for Sofa by  doxygen 1.5.7.1