00001 00005 class FieldPiWisConst : public FieldWithPtValues 00006 00007 { 00008 friend class FieldsPiWisConst; 00009 00010 Handle(GridFE) mesh; 00011 Handle(Vec(NUMT)) subdomain_values; 00012 bool elementsRsubdomains; 00013 00014 HandleElmDefs elmdef; 00015 Mat(real) coor; 00016 00017 bool reallocate 00018 (const GridFE& grid, bool elementsRsubdomains, const char* fieldname); 00019 00020 public: 00021 FieldPiWisConst (); 00022 FieldPiWisConst (const GridFE& grid, bool elementsRsubdomains, 00023 const char* fieldname); 00024 FieldPiWisConst (const GridFE& grid, const Vec(NUMT)& subdomain_values, 00025 const char* fieldname); 00026 ~FieldPiWisConst (); 00027 00028 bool update (); 00029 bool redim (const GridFE& grid, bool elementsRsubdomains, 00030 const char* fieldname); 00031 bool redim (const GridFE& grid, const Vec(NUMT)& subdomain_values, 00032 const char* fieldname); 00033 00034 const GridFE& grid () const { return mesh(); } 00035 GridFE& grid () { return mesh(); } 00036 00037 bool piecewiseConstOverElms () const { return elementsRsubdomains; } 00038 00039 const Vec(NUMT)& values () const { return *subdomain_values; } 00040 Vec(NUMT)& values () { return *subdomain_values; } 00041 00042 00043 void setValueElm (int e, NUMT value); 00044 void setSubDomainValue (int material, NUMT value); 00045 void setMaterialValue (int material, NUMT value) 00046 { setSubDomainValue(material,value); } 00047 00048 void fill (const Vec(NUMT)& values); 00049 void operator = (const FieldPiWisConst& f); 00050 void operator = (const FieldFE& f); 00051 void fill (const FieldsFEatItgPt& f, int component); 00052 00053 virtual bool ok () const; 00054 virtual void minmax (NUMT& min, NUMT& max, GridWithPts* grid =NULL) const; 00055 00056 void point (Ptv(real)& pt, int element); 00057 void point (Ptv(real)& pt, int element) const 00058 { CAST_CONST_AWAY(FieldPiWisConst)->point(pt,element); } 00059 00060 NUMT valueElm (int e) const; 00061 00062 virtual NUMT valuePt (const Ptv(real)& x, real t = DUMMY); 00063 virtual NUMT valueFEM (const FiniteElement& fe, real t = DUMMY); 00064 00065 virtual Ptv(NUMT) derivativePt (const Ptv(real)& x, real t = DUMMY); 00066 void derivativeElm (Ptv(NUMT)& der, int e); 00067 virtual void derivativeFEM (Ptv(NUMT)& d, const FiniteElement& fe, 00068 real t = DUMMY); 00069 virtual void hessianPt (Ptv(NUMT)&, const Ptv(real)&, real = DUMMY); 00070 virtual void hessianFEM (Ptv(NUMT)&, const FiniteElement&, real = DUMMY); 00071 00072 virtual void fill (NUMT value); 00073 virtual void add (NUMT value); 00074 virtual void mult (NUMT value); 00075 virtual void apply (Func(NUMT) f); 00076 virtual void add (Field& field, int power, NUMT front_factor); 00077 00078 virtual Field& scale (); 00079 virtual Field& unscale (); 00080 00081 virtual void unloadData (Os os) const; 00082 virtual void loadData (Is is); 00083 virtual void attach (Grid& grid); 00084 virtual Grid* getGridBase(); 00085 00086 00087 00088 virtual int getNoPoints () const 00089 { return subdomain_values->size(); } 00090 00091 virtual int getNoValues () const 00092 { return subdomain_values->size(); } 00093 00094 virtual NUMT& valuePoint (int point_no) 00095 { return subdomain_values( (point_no);) } 00096 00097 virtual NUMT valuePoint (int point_no) const 00098 { return subdomain_values( (point_no);) } 00099 00100 virtual Ptv(real) getPt (int point_no) const; 00101 00102 virtual GridWithPts& getGridWithPts (); 00103 virtual const GridWithPts& getGridWithPts () const; 00104 00105 virtual Vec(NUMT)& valuesVec() 00106 { return *subdomain_values; } 00107 virtual const Vec(NUMT)& valuesVec() const 00108 { return *subdomain_values; } 00109 00110 CLASS_INFO 00111 VIRTUAL_CAST(FieldPiWisConst); 00112 00113 COPY_CONSTRUCTOR(FieldPiWisConst); 00114 00115 virtual void print (Os os) const; 00116 void scan (Is is); 00117 }; 00118 00119