00001 #ifndef _BASE_FIELD_H_ 00002 #define _BASE_FIELD_H_ 00003 00004 #include<string> 00005 #include"fv_compiler.h" 00006 #include"BaseHandle.h" 00007 00008 namespace FemViewer { 00009 00010 extern const char FieldType[]; 00011 00012 struct SolutionData 00013 { 00014 int nrSolutions; 00015 int nrEquetions; 00016 int currSolution; 00017 std::string sFormula; 00018 SolutionData() : nrSolutions(0), nrEquetions(0), currSolution(0), sFormula("v0") 00019 {} 00020 SolutionData(const SolutionData& rhs) 00021 { 00022 nrSolutions = rhs.nrSolutions; 00023 nrEquetions = rhs.nrEquetions; 00024 currSolution = rhs.currSolution; 00025 sFormula = rhs.sFormula; 00026 } 00027 bool IsInit() const {return (nrSolutions > 0); } 00028 bool operator=(const SolutionData& rhs) 00029 { 00030 bool result(false); 00031 result = (rhs.nrSolutions == nrSolutions) ? false : true; 00032 result = (rhs.nrEquetions == nrEquetions) ? false : true; 00033 result = (rhs.currSolution == currSolution) ? false : true; 00034 result = (rhs.sFormula == sFormula) ? false : true; 00035 if(result) 00036 { 00037 nrSolutions = rhs.nrSolutions; 00038 nrEquetions = rhs.nrEquetions; 00039 currSolution = rhs.currSolution; 00040 sFormula = rhs.sFormula; 00041 } 00042 return result; 00043 } 00044 void Clear() 00045 { 00046 nrSolutions = 0; 00047 nrEquetions = 0; 00048 currSolution = 0; 00049 sFormula = "v0"; 00050 } 00051 }; 00052 00053 class BaseField : protected BaseHandle 00054 { 00055 protected: 00057 static int_global_solutiom apr_global_solution; 00058 static double_el_calc apr_elem_calc_3D_mod; 00059 static intfcharp module_introduce; 00060 static intfchar5intcharpfnp init_field; 00061 static intfint free_field; 00062 static intf2int get_base_type; 00063 static intfint get_nr_sol; 00064 static intfint get_nreq; 00065 static intf2intintp get_el_pdeg; 00066 static intf2intintp get_el_pdeg_numshap; 00067 static intf3intdoublep get_element_dofs; 00068 00070 SolutionData _solution; 00071 bool _isSolutionChanged; 00072 public: 00073 static int GetApproximationType(); 00074 // Get field index 00075 int& Id() { return(this->idx()); } 00076 const int& Id() const { return(this->idx()); } 00077 // Get handle to field type 00078 HandleType& GetType() { return this->type(); } 00079 const HandleType& GetType() const { return this->type(); } 00080 // Gets the number of components in solution 00081 int& GetNreq() { return(_solution.nrEquetions); } 00082 const int& GetNreq() const { return(_solution.nrEquetions); } 00083 // Gets the current number of solutions 00084 int& GetNrSol() { return(_solution.nrSolutions); } 00085 const int& GetNrSol() const { return(_solution.nrSolutions); } 00086 // Gets the index of the current solution 00087 int& GetCurrSol() { return(_solution.currSolution); } 00088 const int& GetCurrSol() const { return(_solution.currSolution); } 00089 // Gets function formula 00090 std::string& GetFromula() { return(_solution.sFormula); } 00091 const std::string& GetFromula() const { return(_solution.sFormula); } 00092 void SetSolution(const SolutionData& rhs) 00093 { 00094 _isSolutionChanged = (_solution = rhs); 00095 } 00096 SolutionData& GetSolution() { return _solution; } 00097 const SolutionData& GetSolution() const { return _solution; } 00098 00099 bool IsSolutionChanged() const { return _isSolutionChanged; } 00100 00101 // Default constructor 00102 explicit BaseField(const HandleType& type_ = Unknown) 00103 : BaseHandle(type_) 00104 , _solution(), _isSolutionChanged(false) 00105 { } 00106 00107 // Public destructor 00108 virtual ~BaseField() {} 00109 00110 // Initialization 00111 virtual int Init(const char* name, const int parent_id_); 00112 00113 // Release field data 00114 virtual int Free(); 00115 00116 // Reload operation 00117 //virtual int Reload(); 00118 00119 // Do update after somthing 00120 //virtual int Update(); 00121 00122 // Clear all 00123 virtual void Reset(); 00124 00125 // Is geometry ini 00126 //virtual bool IsGeometryInit() const = 0; 00127 00128 // Init geomerty 00129 //virtual void InitGeometry(void * pObject = NULL, char type = '\0') {}; 00130 00131 // Reset geometry 00132 //virtual void ResetGeometry(void *pObject = NULL, char type = '\0') = 0; 00133 00134 }; 00135 00136 00137 00138 00139 } 00140 #endif /* _BASE_FIELD_H_ 00141 */