Fluid Dynamics Library
importerbase.h
00001 
00022 #ifndef __FDL_IMPORTER_BASE_H
00023 #define __FDL_IMPORTER_BASE_H
00024 
00025 #include <string>
00026 #include <set>
00027 #include <exception>
00028 #include <iostream>
00029 
00030 //#define TIXML_USE_STL
00031 #include "tinyxml.h"
00032 
00033 #include "cg/vecmath/vec3.hpp"
00034 #include "core/common.h"
00035 #include "core/scalars.hpp"
00036 
00037 namespace fdl {
00038         
00039 /*
00040 struct Output {
00041         std::string format;
00042         std::string filePrefix;
00043         std::string filePath;
00044         
00045         inline Output(const std::string fmt="", const std::string pre="", const std::string path="")
00046                 : format(fmt), filePrefix(pre), filePath(path) {}
00047         
00048 };
00049 */
00050 
00051 class ImporterBase {
00052 public:
00053         ImporterBase();
00054         ~ImporterBase();
00055     virtual int load(const std::string& filename);
00056     virtual int save(const std::string& filename);
00057 
00058         int getLoggerLevel() { return m_logLevel; }
00059         int getGridWidth() { return m_width; }
00060         int getGridHeight() { return m_height; }
00061         int getGridDepth() { return m_depth; }
00062         int getSolverType() { return m_solverType; }
00063         int getSolverMaxIterations() { return m_solverMaxIterations; }
00064         int useGlutWindow() { return m_useGlutWindow; }
00065         int getGlutWindowWidth() { return m_glutWindowWidth; }
00066         int getGlutWindowHeight() { return m_glutWindowHeight; }
00067         double getTimeStep() { return m_timeStep; }
00068         double getGridCellSize() { return m_gridCellSize; }
00069         double getSolverTolerance() { return m_solverTolerance; }
00070         double getDefaultDensity() { return m_defaultDensity; }
00071         double getDefaultSourceTemperature() { return m_defaultSourceTemperature; }
00072         double getDefaultSolidTemperature() { return m_defaultSolidTemperature; }
00073         std::vector<cg::vecmath::Vector3>& getForces() { return *m_forces; }
00074         std::vector<fdl::ScalarBase<double> >& getSources() { return *m_sources; }
00075 
00076 protected:
00077         int m_logLevel;
00078         int m_width;
00079         int m_height;
00080         int m_depth;
00081         int m_glutWindowWidth;
00082         int m_glutWindowHeight;
00083         bool m_useGlutWindow;
00084         int m_solverMaxIterations;
00085         double m_solverTolerance;
00086         double m_timeStep;
00087         double m_gridCellSize;
00088         int m_solverType;
00089         double m_defaultDensity;
00090         double m_defaultSourceTemperature;
00091         double m_defaultSolidTemperature;
00092         bool m_vorticityConfinement;
00093         //std::vector<Output>* m_outputs;
00094         std::vector<fdl::ScalarBase<double> >* m_sources;
00095         std::vector<cg::vecmath::Vector3>* m_forces;
00096         
00097         int intFromChars(const char* word);
00098         int intFromStr(std::string node);
00099         double doubleFromChars(const char* word);
00100         
00101         void parseSettings(TiXmlElement* ele);
00102         void parseLogger(TiXmlElement* ele);
00103         void parseForces(TiXmlElement* ele);
00104         void parseSources(TiXmlElement* ele);
00105 };
00106 
00107 }       // namespace fdl
00108 
00109 #endif  // __FDL_IMPORTER_BASE_H