Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

GridFE.h

Go to the documentation of this file.
00001 
00005 class GridFE : public GridWithPts
00006 
00007 {
00008   friend class FieldFE;            
00009   friend class BasisFuncGrid;      
00010   friend class FieldPiWisConst;
00011   friend class MathLinkInterface;
00012   
00013   friend class GridFEInfo;
00014   friend class GridFEAdB;
00015   friend class MLGridFEAdB;
00016   friend class GridDynFE;
00017   
00018   friend class PreproBox;
00019   friend class PreproBoxDKT;
00020   friend class PreproGeomPack;
00021   friend class ManipGridDynFE;
00022 
00023 protected:
00024 
00025   MatSimple(int)     nodel;         
00026   MatSimple(real)    coor;          
00027 
00028   Handle(Indicators) bind;          
00029 
00030   int                nne;           
00031   VecSimple(int)     nne_all;       
00032   int                maxnne;
00033 
00034   String             elm_tp;        
00035   VecSimple(String)  elm_tp_all;    
00036 
00037   bool            onemat;           
00038   VecSimple(int)  material_type;    
00039 
00040   int nsd;                          
00041   int nsd_phys;                     
00042   int nno;                          
00043   int nel;                          
00044 
00045   Handle(VecSimpleH(int)) nodal_map; 
00046 
00047 public:
00048   GridFEInfo      additional_info;  
00049   BasisFuncGrid*  associated_bfg;   
00050   Handle(Indicators) elmind;        
00051   static bool     smart_pt_search;  
00052 
00053 protected:
00054   bool            uniform_mesh;     
00055   bool            same_elm_tp;      
00056 
00057   Handle(GridLattice) lattice_data;
00058   HandleElmDefs       elmdef;
00059 
00060 public:
00061 
00062   virtual int  getNoSpaceDim () const;
00063           int  getNoPhysicalSpaceDim () const;
00064 
00065   int getNoNodes () const               { return nno; }
00066   int getNoElms  () const               { return nel; }
00067   int getNoBoInds () const              { return bind->getNoInds(); }
00068 
00069   bool allElmsOfSameType () const    { return getbool(nne > 0); }
00070   bool hasUniformMesh () const       { return uniform_mesh; }
00071   void setUniformMesh ();
00072   void setNonUniformMesh ();
00073   int  getNoMaterials () const;      
00074 
00075   GridFE();
00076   GridFE (const GridFE& grid);
00077 
00078   bool redim
00079     (
00080      int nsd,              
00081      int nno,              
00082      int nel,              
00083      int maxnne,           
00084      int nbind,            
00085      int nne,              
00086      bool onemat = true,   
00087      bool keep_associated_bfg = false  
00088     );
00089 
00090  ~GridFE();
00091 
00092   bool ok () const;
00093   void operator = (const GridFE& grid);
00094   virtual bool notEqual (const GridFE& grid, int check_level = 2,
00095                          bool silent = false);
00096 
00097   int       getNoNodesInElm (int e) const   {return nne==0 ? nne_all(e):nne; }
00098   int       getMaxNoNodesInElm () const   { return maxnne; }
00099   int       getMaterialType (int e) const;
00100   bool      oneMaterialType() { return onemat; }
00101   String    getElmType (int e) const;
00102   void      getElmCoor (Mat(real)& elmcoor, int elm_no) const;
00103   real      getCoor (int node, int dir) const  { return coor(node,dir); }
00104   Ptv(real) getCoor (int node) const;
00105   void      getCoor (Ptv(real)& point, int node) const;
00106   virtual void getMinMaxCoord (Ptv(real)& mincoord, Ptv(real)& maxcoord) const;
00107 
00108   Ptv(real) getLocalCoor (int elm_no, int local_node) const;
00109   Ptv(real) getLocalCentroid (int elm_no);
00110   Ptv(real) getGlobalCentroid (int elm_no);
00111   Ptv(real) getGlobalCentroid (int elm_no) const
00112     { return CAST_CONST_AWAY(GridFE)->getGlobalCentroid (elm_no); }
00113   Ptv(real) getGlobalMeanCentroid (int elm_no);
00114 
00115   
00116   int loc2glob (int e, int local_node) const { return nodel(e,local_node);}
00117   #define loc2glob_eff loc2glob  /* for backward compatibility */
00118 
00119   
00120   String getBoIndName (int indno) const  { return ( bind->getName(indno) ); }
00121   
00122   
00123   bool boSide (int elm_no, int side, int indno, const ElmDef& elm) const;
00124   bool boNode (int node, int indno) const  { return bind->on(node,indno); }
00125   bool boNode (int node) const; 
00126   
00127   bool boNodesInElm (int elm_no, int indno) const;
00128   bool boNodesInElm (int elm_no) const;  
00129   bool boInd (int ind) const; 
00130 
00131   /* the next defines are for backward compatibility: */
00132   #define BoSide boSide
00133   #define BoNode boNode
00134   #define BoNodesInElm boNodesInElm
00135   #define BoInd  boInd             
00136 
00137   const Indicators& boundaryData () const  { return bind.getRef(); }
00138         Indicators& boundaryData ()        { return bind.getRef(); }
00139   void  attach (const Indicators& boinds);
00140 
00141   
00142   void redefineBoInds (Is is)  { bind->redefine (is); }
00143   void addBoIndNodes  (Is is, bool add = ON /*OFF: delete indicators*/);
00144 
00145   void addMaterial   (Is is);
00146   int addMaterial(int material_number,const MatSimple(real)& polygon);
00147   int insidePolygon(const MatSimple(real)& polygon, const Ptv(real)& globpt );
00148 
00149   
00150   void scanLattice   (Is is);
00151   void operator= (const GridLattice& lattice);
00152   virtual bool isLattice () const { return getbool(lattice_data.ok()); }
00153   virtual bool isReallyLattice () const; 
00154   const GridLattice& getLattice () const { return lattice_data(); }
00155   void refineIfBox (const Ptv(int)& refinement_factor);
00156 
00157   
00158   
00159   void move (const FieldsFE& displacement, real scale_factor = 1.0);
00160   void move (FieldsFunc& func, real time = DUMMY);
00161   void move (const Mat(real)& new_coor);
00162   void move (const Vec(real)& new_coor, int dir);
00163   void move (const GridFE& grid);
00164 
00165   
00166   virtual void startIterator ();
00167   virtual bool nextPt (Ptv(real)& x);
00168           bool nextPt (Ptv(real)& x, int& node);
00169   virtual int  getNoPoints () const  { return nno; }
00170 
00171   
00172   int isNode (const Ptv(real)& point); 
00173 
00174   virtual int nearestPoint
00175     (const Ptv(real)& point,
00176            real&      distance,
00177            bool&      exact);
00178 
00179   bool isNodeInElm (int node, int e);
00180   void boundingBox (int e, Ptv(real)& min, Ptv(real)& max);
00181 
00182   void findElmAndLocPt                 
00183     (
00184      const Ptv(real)& glob_pt,
00185            int&       element,
00186            Ptv(real)& loc_pt,
00187            int*       n_Newton_iter = NULL,
00188            real*      Newton_error = NULL
00189     );
00190 
00191   void findElmAndLocPt
00192     (
00193      const Ptv(real)& glob_pt,
00194            int&       element,
00195            Ptv(real)& loc_pt,
00196            int&       node,
00197            bool       force_element_search = false,
00198            int*       n_Newton_iter = NULL,
00199            real*      Newton_error = NULL
00200     );
00201 
00202   void findElmAndLocPtFE
00203     (
00204      const Ptv(real)& glob_pt,
00205          int&       element,
00206          Ptv(real)& loc_pt,
00207          int*       n_Newton_iter,
00208          real*      Newton_error
00209     );
00210 
00211   void findElmAndLocPtLatt
00212     (
00213      const Ptv(real)& glob_pt,
00214            int&       element,
00215            Ptv(real)& loc_pt,
00216            int*       n_Newton_iter,
00217            real*      Newton_error
00218     );
00219 
00220   
00221   friend Os& operator << (Os& os, const GridFE& mesh);
00222   friend Is& operator >> (Is& is, GridFE& mesh);
00223   virtual void print (Os os) const;
00224   virtual void scan  (Is is);
00225 
00226   virtual void   scale ();  
00227   virtual void unscale ();  
00228           void attachScale (const SpaceTimeScale& scale);
00229 
00230   
00231   real calcTolerance (real div_factor = 100.0) const;
00232 
00233 
00234   
00235   
00236 
00237   void setMaterialType (int e, int material_number);
00238   void setElmType (int e, const String& type);    
00239   void setElmType (const String& from, const String& to);
00240   void setElmType (const String& name);  
00241   void setNoNodesInElm (int e, int nnodes);
00242   void fillCoor (real value)            { coor.fill(value); }
00243   void setNoPhysicalSpaceDim (int nsd_phys);
00244 
00245   
00246   void putCoor (real value, int node, int dir)  { coor(node,dir)=value; }
00247   void putCoor (const Ptv(real)& point, int node);
00248   void putLoc2Glob (int global_node, int e, int local_node)
00249     { nodel(e,local_node) = global_node; }
00250 
00251   void setBoInd (int node, int indno)    { bind->set(node,indno); }
00252   void clearBoInd (int node, int indno)  { bind->clear(node,indno); }
00253   void clearBoInds ()                    { bind->fill(OFF); }
00254   void putBoIndName (const String& name, int indno)
00255     { bind->putName(name,indno); }
00256 
00257   int  searchPoint (const Ptv(real)& point);
00258   void updateElmConnect( int nodeno, int newnodeno);
00259   virtual void newNodalNumbering (VecSimpleH(int)& old2new);
00260   virtual void getNodalMapping   (VecSimpleH(int)& old2new, bool& identity);
00261   virtual void isToBeChanged ();  
00262   virtual void flipAroundSymmetryPlane (int dir, real plane);
00263 
00264   
00265   void nodeCouplings (int node, VecSimple(int)& couplings);
00266   virtual void constraintCouplings(VecSimplest(SetDistinct(int))& /*n2n*/,
00267                                    int /*array_no*/ = 0) {}
00268   virtual int getNoConstraints () const { return 0; }
00269   virtual int calcBandwidth () const;
00270   virtual int getGridLevelNo () { return 1; }
00271   virtual GridFE& getStartGrid() { return *this; }
00272   virtual void modify4constraints
00273     (DegFreeFE& /*dof*/, Matrix(NUMT)& /*A*/, Vector(NUMT)& /*b*/) {}
00274   virtual void modifyField4constraints (FieldFE&) {}
00275 
00276 protected:
00277   void printAscii  (Os os) const;
00278   void scanAscii   (Is is);
00279   void printBinary (Os os) const;
00280   void scanBinary  (Is is);
00281   int current_node;    
00282   Mat(real) elmcoor_;  
00283 
00284 public:
00285   CLASS_INFO
00286 
00287   VIRTUAL_CAST(GridFE)
00288 };
00289 
00290  String getBoIndName (int indno) const 
00668 See documentation of one of the overloaded functions.
00669 */
00670 ) 
00808        makes it possible to mark new nodes with one of the exisiting
00809        boundary indicators. New nodes are given as a hypercube domain,
00810        usually collapsing to a line or surface, and the function will
00811        process all nodes that are inside this domain. Here is an
00812        example of an input string to the function.
00813 
00814 \verbatim
00815       "n=2 b1=[0,0]x[1,1] b4=[1,4]x[2,2]"
00816 \endverbatim
00817        First the number of boundary indicators that are to be modified
00818        (extended) must be given; it is 2 in this example.  Then each
00819        boundary indicator number of interest is preceeded by a "b" and
00820        then its number, then an equal sign, and finally a tensor
00821        product of intervals that defines the domain. All nodes inside
00822        this domain (the property of being inside is determined by some
00823        tolerance, by the function "Interval ::inWithTolerance"; the
00824        tolerance equals the global variable "comparison_tolerance"
00825        that is set in the "initDiffpack" function if the command line
00826        argument "--tolerance" appears) are marked with the boundary
00827        indicator. Here the point (0,1) will be marked with indicator 1
00828        and all nodes along the line y=2, between x=1 and x=4 will be
00829        marked with indicator 4.  Sometimes one wants to mark just the
00830        nodes inside the domain that are already marked by an
00831        indicator. This is achieved by putting a capital B before the
00832        hypercubes:
00833 
00834 \verbatim
00835       "n=2 b1=B[0,0]x[1,1] b4=B[1,4]x[2,2]"
00836 \endverbatim
00837        The "B" option is useful for curved boundaries since it enables
00838        only the nodes on the curved boundary to be marked (and not
00839        internal nodes as well).
00840 
00841        The main application of this routine is when simple indication
00842        of boundary indicators were made in the preprocessor and you
00843        want to introduce another marking of boundary nodes. For
00844        example, only the different sides of the domain were marked by
00845        the preprocessor, and the user wants to assign boundary
00846        conditions to single nodes or to parts of a side.  Often the
00847        "redefineBoInds" function is called first to extend or reduce
00848        the number of indicators. The new indicators can then be filled
00849        using "addBoIndNodes." It can often be convenient to introduce
00850        an indicator that is not used in computations, but only for
00851        marking the (whole) boundary. This makes it easier to use the
00852        capital B option in front of the hypercubes (the boundary is
00853        then already marked, and "addBoIndNodes" sets correct
00854        additional markers for computational purposes).  (In the input
00855        string, the first "=", the "b" and the "=" are the significant
00856        characters, strange errors may occur if these characters are
00857        missing).
00858 
00859        The final argument, "bool add", can be given "false" or "OFF"
00860        as value.  In that case the indicators are turned off instead
00861        of on. Often one must make two calls to "addBoIndNodes", first
00862        turning some indicators on and then turning other indicators
00863        off at the same part of the boundary.
00864 
00865 */
00866 , int /*array_no*/ = 0) 
01214        see documentation of the function "nodeCoupling".
01215 
01216 */
01217 

Copyright © 2003 inuTech GmbH. All rights reserved.