00001 00005 class FieldLattice : public FieldWithPtValues 00006 00007 { 00008 00009 00010 int nsd; 00011 Handle(GridLattice) mesh; 00012 Handle(ArrayGenSel(NUMT)) vec; 00013 int fict_boundary; 00014 00015 bool reallocate 00016 ( 00017 const GridLattice& grid, 00018 const ArrayGen(NUMT)* coefficients =NULL, 00019 const char* fieldname = NULL 00020 ); 00021 00022 00023 bool reallocate 00024 ( 00025 GridLattice& grid, 00026 const ArrayGenSel(NUMT)* coefficients = NULL, 00027 GridLattice ::Component comp = GridLattice:: none, 00028 int fict_boundary = 0, 00029 const char* fieldname = NULL, 00030 const bool change_staggered_grid = true 00031 ); 00032 00033 public: 00034 FieldLattice (); 00035 00036 00037 FieldLattice (const GridLattice& grid, 00038 const char* fieldname); 00039 FieldLattice (const GridLattice& grid, ArrayGen(NUMT)& coefficients, 00040 const char* fieldname); 00041 FieldLattice (const GridLattice& grid, ArrayGenSel(NUMT)& coefficients, 00042 const char* fieldname); 00043 FieldLattice (const GridLattice& grid, const int fict_boundary, 00044 const char* fieldname); 00045 FieldLattice (const GridLattice& grid, GridLattice ::Component comp, 00046 const char* fieldname, const bool change_staggered_grid=true); 00047 FieldLattice (const GridLattice& grid, GridLattice ::Component comp, 00048 const int fict_boundary, const char* fieldname, 00049 const bool change_staggered_grid = true); 00050 00051 ~FieldLattice (); 00052 00053 bool redim (const GridLattice& grid, const char* fieldname); 00054 00055 00056 bool redim (const GridLattice& grid, const ArrayGen(NUMT)& coefficients, 00057 const char* fieldname); 00058 00059 bool redim (const GridLattice& grid, const ArrayGenSel(NUMT)& coeff, 00060 const char* fieldname); 00061 00062 bool redim (const GridLattice& grid, const int fict_boundary, 00063 const char* fieldname); 00064 00065 bool redim (const GridLattice& grid, GridLattice ::Component comp, 00066 const char* fieldname, 00067 const bool change_staggered_grid = true); 00068 00069 00070 bool redim (const GridLattice& grid, GridLattice ::Component comp, 00071 const int fict_boundary, const char* fieldname, 00072 const bool change_staggered_grid = true); 00073 00074 00075 bool redim (const FieldLattice& f, const char* fieldname); 00076 00077 GridLattice& grid () { return mesh.getRef(); } 00078 const GridLattice& grid () const { return mesh.getRef(); } 00079 ArrayGenSel(NUMT)& values () { return vec.getRef(); } 00080 const ArrayGenSel(NUMT)& values () const { return vec.getRef(); } 00081 ArrayGen(NUMT)& values0 (); 00082 const ArrayGen(NUMT)& values0 () const; 00083 00084 bool ghostBoundary () const; 00085 00086 void exchangeValues (FieldLattice& f); 00087 00088 bool empty () const; 00089 virtual bool ok () const; 00090 virtual void minmax (NUMT& min, NUMT& max, GridWithPts* grid =NULL) const; 00091 00092 00093 00094 NUMT& valueIndex (int i); 00095 NUMT& valueIndex (int i, int j); 00096 NUMT& valueIndex (int i, int j, int k); 00097 NUMT valueIndex (int i) const; 00098 NUMT valueIndex (int i, int j) const; 00099 NUMT valueIndex (int i, int j, int k) const; 00100 00101 00102 00103 NUMT& valueIndex (double i); 00104 NUMT& valueIndex (double i, double j); 00105 NUMT& valueIndex (double i, double j, double k); 00106 NUMT valueIndex (double i) const; 00107 NUMT valueIndex (double i, double j) const; 00108 NUMT valueIndex (double i, double j, double k) const; 00109 00110 int fictBoundary () const { return fict_boundary; } 00111 00112 00113 NUMT& valueIndex (const Ptv(int)& index); 00114 NUMT valueIndex (const Ptv(int)& index) const; 00115 void value (const ArrayGenSel(NUMT)& values); 00116 00117 virtual NUMT valuePt (const Ptv(real)& x, real t = DUMMY); 00118 virtual NUMT valueFEM (const FiniteElement& fe, real t = DUMMY); 00119 00120 virtual Ptv(NUMT) derivativePt (const Ptv(real)& x, real t = DUMMY); 00121 virtual void derivativeFEM (Ptv(NUMT)& d, const FiniteElement& fe, 00122 real t = DUMMY); 00123 00124 void operator = (const FieldLattice& field); 00125 void operator = (const FieldFunc& func); 00126 void fill (const FieldFunc& func, real time = DUMMY); 00127 void copyWithoutGhostBoundary (const FieldLattice& f); 00128 00129 virtual void print (Os os) const; 00130 void scan (Is is); 00131 00132 virtual void fill (NUMT value); 00133 virtual void add (NUMT value); 00134 virtual void mult (NUMT value); 00135 virtual void apply (Func(NUMT) f); 00136 virtual void add (Field& field, int power, NUMT front_factor); 00137 00138 virtual Field& scale (); 00139 virtual Field& unscale (); 00140 00141 virtual void unloadData (Os os) const; 00142 virtual void loadData (Is is); 00143 virtual void attach (Grid& grid); 00144 virtual Grid* getGridBase(); 00145 00146 00147 00148 virtual int getNoPoints () const 00149 { return mesh->getNoPoints(); } 00150 00151 virtual int getNoValues () const 00152 { return vec->size(); } 00153 00154 virtual NUMT& valuePoint (int point_no); 00155 virtual NUMT valuePoint (int point_no) const; 00156 00157 virtual Ptv(real) getPt (int point_no) const 00158 { return mesh->getPt(mesh->single2multiple(point_no)); } 00159 00160 virtual GridWithPts& getGridWithPts () 00161 { return mesh.getRef(); } 00162 00163 virtual const GridWithPts& getGridWithPts () const 00164 { return mesh.getRef(); } 00165 00166 virtual Vec(NUMT)& valuesVec () 00167 { return vec.getRef(); } 00168 00169 virtual const Vec(NUMT)& valuesVec () const 00170 { return vec.getRef(); } 00171 00172 CLASS_INFO 00173 00174 VIRTUAL_CAST(FieldLattice) 00175 00176 00177 00178 COPY_CONSTRUCTOR(FieldLattice); 00179 00180 void pack (CharPack& package); 00181 void unpack (CharPack& package, int package_size); 00182 }; 00183 00184