AFEPack
TemplateElement.h
浏览该文件的文档。
00001 
00002 // TemplateElement.h : by R.Lie
00003 //
00004 
00005 #ifndef _TemplateElement_h_
00006 #define _TemplateElement_h_
00007 
00008 #include <dlfcn.h>
00009 
00010 #include <iostream>
00011 #include <fstream>
00012 #include <vector>
00013 #include <algorithm>
00014 #include <string>
00015 
00016 #include <base/exceptions.h>
00017 
00018 #include "Miscellaneous.h"
00019 #include "Geometry.h"
00020 
00021 template <int DIM> class BasisFunctionIdentity;
00022 template <class value_type, int DIM> class ShapeFunction;
00023 template <class value_type, int DIM, int TDIM> class BasisFunction;
00024 template <int DIM> class TemplateDOF;
00025 template <int TDIM, int DIM> class CoordTransform;
00026 template <class value_type, int DIM, int TDIM> class BasisFunctionAdmin;
00027 template <int DIM> class UnitOutNormal;
00028 template <class value_type, int DIM, int TDIM> class TemplateElement;
00029 
00030 template <int DIM> bool operator==(const BasisFunctionIdentity<DIM>&, const BasisFunctionIdentity<DIM>&);
00031 
00033 
00044 template <int DIM>
00045 class BasisFunctionIdentity 
00046 {
00047  public:
00048   enum { dim = DIM };
00049  public:
00050   unsigned int order; 
00051   int alpha[DIM]; 
00052   unsigned int flag; 
00053  public:
00055   BasisFunctionIdentity() {};
00057   BasisFunctionIdentity(const BasisFunctionIdentity<DIM>& i) {
00058     order = i.order;
00059     for (int j = 0;j < DIM;j ++)
00060       alpha[j] = i.alpha[j];
00061     flag = i.flag;
00062   };
00064   ~BasisFunctionIdentity() {};
00065  public:
00067   BasisFunctionIdentity<DIM>& operator=(const BasisFunctionIdentity<DIM>& i) {
00068     order = i.order;
00069     for (int j = 0;j < DIM;j ++)
00070       alpha[j] = i.alpha[j];
00071     flag = i.flag;
00072     return *this;
00073   };
00074   friend bool operator== <>(const BasisFunctionIdentity<DIM>&, const BasisFunctionIdentity<DIM>&); 
00075   template <class STREAM,int GDIM> 
00076     friend STREAM& operator>>(STREAM&, BasisFunctionIdentity<GDIM>&);
00077   template <class STREAM,int GDIM> 
00078     friend STREAM& operator<<(STREAM&, const BasisFunctionIdentity<GDIM>&);
00079 };
00080 
00081 template <class STREAM, int DIM>
00082   STREAM& operator>>(STREAM& is, BasisFunctionIdentity<DIM>& i)
00083 {
00084   is >> i.order;
00085   for (int j = 0;j < DIM;j ++)
00086     is >> i.alpha[j];
00087   is >> i.flag;
00088   return is;
00089 }
00090 
00091 template <class STREAM, int DIM>
00092   STREAM& operator<<(STREAM& os, const BasisFunctionIdentity<DIM>& i)
00093 {
00094   os << i.order;
00095   for (int j = 0;j < DIM;j ++)
00096     os << i.alpha[j];
00097   os << i.flag;
00098   return os;
00099 }
00100 
00104 template <class value_type, int DIM>
00105   class ShapeFunction
00106 {
00107  public:
00108   typedef value_type value_t;
00109   enum { dim = DIM };
00110  private:
00111   void * handle; 
00112   std::string library_name; 
00113   std::string value_function_name; 
00114   std::string gradient_function_name; 
00115   void (*value_function)(const double *, const double **, void *); 
00116   void (*gradient_function)(const double *, const double **, void *); 
00117  public:
00118   std::string library_path;
00119  public:
00120   ShapeFunction(); 
00121   ShapeFunction(const ShapeFunction<value_type,DIM>&); 
00122   ~ShapeFunction(); 
00123  public:
00124   ShapeFunction<value_type,DIM>& operator=(const ShapeFunction<value_type,DIM>&); 
00125   void loadFunction(); 
00126   void unloadFunction(); 
00127   value_type value(const afepack::Point<DIM>&, const std::vector<afepack::Point<DIM> >&) const; 
00128   std::vector<value_type> gradient(const afepack::Point<DIM>&, const std::vector<afepack::Point<DIM> >&) const; 
00129   std::vector<value_type> value(const std::vector<afepack::Point<DIM> >&, const std::vector<afepack::Point<DIM> >&) const; 
00130   std::vector<std::vector<value_type> > gradient(const std::vector<afepack::Point<DIM> >&, const std::vector<afepack::Point<DIM> >&) const; 
00131   value_type value(const afepack::Point<DIM>&, const double **) const; 
00132   std::vector<value_type> gradient(const afepack::Point<DIM>&, const double **) const; 
00133   std::vector<value_type> value(const std::vector<afepack::Point<DIM> >&, const double **) const; 
00134   std::vector<std::vector<value_type> > gradient(const std::vector<afepack::Point<DIM> >&, const double **) const; 
00136 #ifdef QUADRATIC_ELEMENT_SUPPORT
00137  private:
00138   std::string hesse_function_name;
00139   void (*hesse_function)(const double *, const double **, void *);
00140  public:
00141   std::vector<std::vector<value_type> > 
00142     hesse(const afepack::Point<DIM>&, const std::vector<afepack::Point<DIM> >&) const;
00143   std::vector<std::vector<std::vector<value_type> > > 
00144     hesse(const std::vector<afepack::Point<DIM> >&, const std::vector<afepack::Point<DIM> >&) const;
00145   std::vector<std::vector<value_type> > 
00146     hesse(const afepack::Point<DIM>&, const double **) const;
00147   std::vector<std::vector<std::vector<value_type> > 
00148     hesse(const std::vector<afepack::Point<DIM> >&, const double **) const;
00149 #endif //QUADRATIC_ELEMENT_SUPPORT
00150 
00151   DeclException1(ExcFileOpen, char *,
00152                  << "Can't open library "
00153                  << arg1);
00154   DeclException2(ExcLoadFunction, char *, char *,
00155                  << "Can't load function "
00156                  << arg1
00157                  << " from library "
00158                  << arg2);      
00159  public:
00160   template <class STREAM,class VT,int GDIM> 
00161     friend STREAM& operator>>(STREAM&, ShapeFunction<VT,GDIM>&); 
00162   template <class STREAM,class VT,int GDIM> 
00163     friend STREAM& operator<<(STREAM&, const ShapeFunction<VT,GDIM>&); 
00164 };
00165 
00166 template <class STREAM, class value_type, int DIM>
00167   STREAM& operator>>(STREAM& is, ShapeFunction<value_type,DIM>& f)
00168 {
00169   is >> f.library_name;
00170   is >> f.value_function_name;
00171   is >> f.gradient_function_name;
00172 #ifdef QUADRATIC_ELEMENT_SUPPORT
00173   is >> f.hesse_function_name;
00174 #endif // QUADRATIC_ELEMENT_SUPPORT
00175   f.loadFunction();
00176 
00177   return is;
00178 }
00179 
00180 template <class STREAM, class value_type, int DIM>
00181   STREAM& operator<<(STREAM& os, const ShapeFunction<value_type,DIM>& f)
00182 {
00183   os << f.library_name << "\t"
00184      << f.value_function_name << "\t"
00185      << f.gradient_function_name 
00186 #ifdef QUADRATIC_ELEMENT_SUPPORT
00187      << "\t" << f.hesse_function_name
00188 #endif // QUADRATIC_ELEMENT_SUPPORT
00189      << "\n";
00190   return os;
00191 }
00192 
00196 template <class value_type, int DIM, int TDIM=DIM>
00197   class BasisFunction : public ShapeFunction<value_type, DIM>
00198   {
00199   public:
00200   typedef value_type value_t;
00201   enum { dim = DIM, tdim = TDIM };
00202   public:
00203   typedef BasisFunctionIdentity<TDIM> Identity;
00204   private:
00205   //    TemplateGeometry<TDIM> * geo;
00206   afepack::Point<TDIM> ip;
00207   Identity id;
00208   public:
00209   BasisFunction();
00210   explicit BasisFunction(const afepack::Point<TDIM>&);
00211   BasisFunction(const BasisFunction<value_type,DIM,TDIM>&);
00212   ~BasisFunction();
00213   public:
00214   BasisFunction<value_type,DIM,TDIM>& operator=(const BasisFunction<value_type,DIM,TDIM>&);
00215   void reinit(const afepack::Point<TDIM>&);
00216   const afepack::Point<TDIM>& interpPoint() const;
00217   afepack::Point<TDIM>& interpPoint();
00218   const Identity& identity() const;
00219   Identity& identity();
00220   public:
00221   template <class STREAM,class VT,int GDIM,int TGDIM> 
00222   friend STREAM& operator>>(STREAM&, BasisFunction<VT,GDIM,TGDIM>&);
00223   template <class STREAM,class VT,int GDIM,int TGDIM> 
00224   friend STREAM& operator<<(STREAM&, const BasisFunction<VT,GDIM,TGDIM>&);
00225   };
00226 
00227 template <class STREAM, class value_type, int DIM, int TDIM> 
00228   STREAM& operator>>(STREAM& is, BasisFunction<value_type,DIM,TDIM>& b)
00229 {
00230   is >> b.interpPoint();
00231   is >> b.identity();
00232   is >> dynamic_cast<ShapeFunction<value_type,DIM>&>(b);
00233   return is;
00234 }
00235 
00236 template <class STREAM, class value_type, int DIM, int TDIM> 
00237   STREAM& operator<<(STREAM& os, const BasisFunction<value_type,DIM,TDIM>& b)
00238 {
00239   os << b.interpPoint() << "\n";
00240   os << b.identity() << "\n";
00241   os << dynamic_cast<const ShapeFunction<value_type,DIM>&>(b);
00242   return os;
00243 }
00244 
00249 struct DOFIndex {
00250   int dimension; 
00251   int geometry_index; 
00252   int dof_index; 
00253 };
00254 
00255 template <class value_type, int DIM, int DOW=DIM, int TDIM=DIM>
00256   struct DOFInfo {
00257     enum { dim = DIM, dow = DOW, tdim = TDIM };
00258     typedef value_type value_t;
00259 
00260     typedef typename Mesh<DIM,DOW>::bmark_t bmark_t;
00261     afepack::Point<DOW> interp_point;
00262     typename BasisFunction<value_type,DIM,TDIM>::Identity identity;
00263     bmark_t boundary_mark;
00264   };
00265 
00271 struct DegreeOfFreedom
00272 {
00273   unsigned int n_dof; 
00274   std::vector<std::vector<int> > n_geometry_dof; 
00275   std::vector<std::vector<std::vector<int> > > geometry_dof; 
00276   std::vector<DOFIndex> dof_index; 
00277 };
00278 
00285 template <int DIM>
00286 class TemplateDOF : public DegreeOfFreedom
00287 {
00288  public:
00289   enum { dim = DIM };
00290  private:
00291   TemplateGeometry<DIM> * geometry; 
00292  public:
00293   TemplateDOF(TemplateGeometry<DIM>& = *((TemplateGeometry<DIM> *)NULL)); 
00294   TemplateDOF(const TemplateDOF<DIM>&); 
00295   ~TemplateDOF(); 
00296  public:
00297   TemplateDOF<DIM>& operator=(const TemplateDOF<DIM>&); 
00298   void reinit(TemplateGeometry<DIM>& = *((TemplateGeometry<DIM> *)NULL)); 
00299   void readData(const std::string&); 
00300   void writeData(const std::string&) const; 
00301  public:
00302   template <class STREAM,int GDIM> 
00303     friend STREAM& operator>>(STREAM&, TemplateDOF<GDIM>&); 
00304   template <class STREAM,int GDIM> 
00305     friend STREAM& operator<<(STREAM&, const TemplateDOF<GDIM>&); 
00306 };
00307 
00308 template <class STREAM, int DIM>
00309   STREAM& operator>>(STREAM& is, TemplateDOF<DIM>& t)
00310 {
00311   int i, j, k, l, m;
00312         
00313   for (i = 0;i <= DIM;i ++) {
00314     for (j = 0;j < t.geometry->n_geometry(i);j ++) {
00315       t.n_geometry_dof[i][j] = 0;
00316     }
00317   }
00318   is >> i;
00319   for (t.n_dof = 0, j = 0;j < i;j ++) {
00320     is >> k >> l >> m;
00321     t.n_geometry_dof[k][l] += m;
00322     t.n_dof += m;
00323   }
00324   t.dof_index.resize(t.n_dof);
00325   for (k = 0, i = 0;i <= DIM;i ++) {
00326     for (j = 0;j < t.geometry->n_geometry(i);j ++) {
00327       t.geometry_dof[i][j].resize(t.n_geometry_dof[i][j]);
00328       for (l = 0;l < t.n_geometry_dof[i][j];l ++) {
00329         t.dof_index[k].dimension = i;
00330         t.dof_index[k].geometry_index = j;
00331         t.dof_index[k].dof_index = l;
00332         t.geometry_dof[i][j][l] = k ++;
00333       }
00334     }
00335   }
00336   return is;
00337 }
00338 
00339 template <class STREAM, int DIM>
00340   STREAM& operator<<(STREAM& os, const TemplateDOF<DIM>& t)
00341 {
00342   int i, j, k;
00343         
00344   for (k = 0, i = 0;i <= DIM;i ++) {
00345     for (j = 0;j < t.geometry->n_geometry(i);j ++) {
00346       if (t.n_geometry_dof[i][j] > 0)
00347         k ++;
00348     }
00349   }
00350   os << k << "\n";
00351   for (i = 0;i <= DIM;i ++) {
00352     for (j = 0;j < t.geometry->n_geometry(i);j ++) {
00353       if (t.n_geometry_dof[i][j] > 0) {
00354         os << i << "\t"
00355            << j << "\t"
00356            << t.n_geometry_dof[i][j] << "\n";
00357       }
00358     }
00359   }
00360   return os;
00361 }
00362 
00371 template <int TDIM, int DIM=TDIM>
00372   class CoordTransform
00373   {
00374   public:
00375   enum { dim = DIM, tdim = TDIM };
00376   typedef afepack::Point<DIM> point_t;
00377   typedef afepack::Point<TDIM> ref_point_t;
00378   private:
00379   void * handle; 
00380   std::string library_path;
00381   std::string library_name; 
00382   std::string l2g_function_name; 
00383   std::string g2l_function_name; 
00384   std::string l2g_jacobian_function_name; 
00385   std::string g2l_jacobian_function_name; 
00386   void (*l2g_function)(const double *, const double **, const double **, double *); 
00387   void (*g2l_function)(const double *, const double **, const double **, double *); 
00388   double (*l2g_jacobian_function)(const double *, const double **, const double **); 
00389   double (*g2l_jacobian_function)(const double *, const double **, const double **); 
00390   public:
00391   CoordTransform(); 
00392   CoordTransform(const CoordTransform<TDIM,DIM>&); 
00393   ~CoordTransform(); 
00394   public:
00395   CoordTransform<TDIM,DIM>& operator=(const CoordTransform<TDIM,DIM>&); 
00396   void loadFunction(); 
00397   void unloadFunction(); 
00398   point_t local_to_global(const ref_point_t&, 
00399                           const std::vector<ref_point_t >&, 
00400                           const std::vector<point_t >&) const; 
00401   ref_point_t global_to_local(const point_t&, 
00402                               const std::vector<ref_point_t >&, 
00403                               const std::vector<point_t >&) const; 
00404   double local_to_global_jacobian(const ref_point_t&, 
00405                                   const std::vector<ref_point_t >&, 
00406                                   const std::vector<point_t >&) const; 
00407   double global_to_local_jacobian(const point_t&,
00408                                   const std::vector<ref_point_t >&, 
00409                                   const std::vector<point_t >&) const; 
00410   std::vector<point_t > local_to_global(const std::vector<ref_point_t >&, 
00411                                         const std::vector<ref_point_t >&, 
00412                                         const std::vector<point_t >&) const; 
00413   std::vector<ref_point_t > global_to_local(const std::vector<point_t >&, 
00414                                             const std::vector<ref_point_t >&, 
00415                                             const std::vector<point_t >&) const; 
00416   std::vector<double> local_to_global_jacobian(const std::vector<ref_point_t >&, 
00417                                                const std::vector<ref_point_t >&, 
00418                                                const std::vector<point_t >&) const; 
00419   std::vector<double> global_to_local_jacobian(const std::vector<point_t >&,
00420                                                const std::vector<ref_point_t >&, 
00421                                                const std::vector<point_t >&) const; 
00422   void readData(const std::string&); 
00423   void writeData(const std::string&) const; 
00425   DeclException1(ExcFileOpen, char *,
00426                  << "Can't open library "
00427                  << arg1);
00428   DeclException2(ExcLoadFunction, char *, char *,
00429                  << "Can't load function "
00430                  << arg1
00431                  << " from library "
00432                  << arg2);      
00433   public:
00434   template <class STREAM,int TGDIM,int GDIM> 
00435   friend STREAM& operator>>(STREAM&, CoordTransform<TGDIM,GDIM>&); 
00436   template <class STREAM,int TGDIM,int GDIM> 
00437   friend STREAM& operator<<(STREAM&, const CoordTransform<TGDIM,GDIM>&); 
00438   };
00439 
00440 template <class STREAM, int TDIM, int DIM>
00441   STREAM& operator>>(STREAM& is, CoordTransform<TDIM,DIM>& c)
00442 {
00443   is >> c.library_name
00444      >> c.l2g_function_name
00445      >> c.g2l_function_name
00446      >> c.l2g_jacobian_function_name
00447      >> c.g2l_jacobian_function_name;
00448         
00449   c.loadFunction();
00450   return is;
00451 }
00452 
00453 template <class STREAM, int TDIM, int DIM>
00454   STREAM& operator<<(STREAM& os, const CoordTransform<TDIM,DIM>& c)
00455 {
00456   os << c.library_name << "\n\t"
00457      << c.l2g_function_name << "\t"
00458      << c.g2l_function_name << "\t"
00459      << c.l2g_jacobian_function_name << "\t"
00460      << c.g2l_jacobian_function_name << "\n";
00461         
00462   return os;
00463 }
00464 
00471 template <class value_type, int DIM, int TDIM=DIM>
00472   class BasisFunctionAdmin : public std::vector<BasisFunction<value_type,DIM,TDIM> >
00473   {
00474   public:
00475   typedef value_type value_t;
00476   enum { dim = DIM, tdim = TDIM };
00477   typedef BasisFunction<value_t,DIM,TDIM> basis_func_t;
00478 
00479   private:
00480   typedef BasisFunctionAdmin<value_type,DIM,TDIM> basis_func_admin_t;
00481 
00482   std::string library_path;
00483   TemplateDOF<TDIM> * df; 
00484   public:
00485   BasisFunctionAdmin(); 
00486   BasisFunctionAdmin(const int&); 
00487   BasisFunctionAdmin(const int&, TemplateDOF<TDIM>&); 
00488   BasisFunctionAdmin(TemplateDOF<TDIM>&); 
00489   BasisFunctionAdmin(const basis_func_admin_t&); 
00490   ~BasisFunctionAdmin(); 
00491   public:
00492   void reinit(TemplateDOF<TDIM>&); 
00493   basis_func_admin_t& operator=(const basis_func_admin_t&); 
00494   const TemplateDOF<TDIM>& dof() const; 
00495   TemplateDOF<TDIM>& dof(); 
00496   void readData(const std::string&); 
00497   void writeData(const std::string&) const; 
00498   public:
00499   template <class STREAM,class VT,int GDIM,int TGDIM> 
00500   friend STREAM& operator>>(STREAM&, BasisFunctionAdmin<VT,GDIM,TGDIM>&); 
00501   template <class STREAM,class VT,int GDIM,int TGDIM> 
00502   friend STREAM& operator<<(STREAM&, const BasisFunctionAdmin<VT,GDIM,TGDIM>&); 
00503   };
00504 
00505 template <class STREAM, class value_type, int DIM, int TDIM>
00506   STREAM& operator>>(STREAM& is, BasisFunctionAdmin<value_type,DIM,TDIM>& b)
00507 {
00508   unsigned int i, j, k, l;
00509         
00510   is >> i;
00511   if (i != b.df->n_dof) {
00512     std::cerr << "number of basis functions: " << i
00513               << "\n is not equal to"
00514               << "\nnumber of dofs: " << b.df->n_dof
00515               << std::endl;
00516     abort();
00517   }
00518   b.resize(i);
00519   std::vector<std::vector<int> > count;
00520   j = b.df->n_geometry_dof.size();
00521   count.resize(j);
00522   for (k = 0;k < j;k ++)
00523     count[k].resize(b.df->n_geometry_dof[k].size(), 0);
00524   for (j = 0;j < i;j ++) {
00525     is >> k >> l;
00526     b[b.df->geometry_dof[k][l][count[k][l]]].library_path = b.library_path;
00527     is >> b[b.df->geometry_dof[k][l][count[k][l] ++]];
00528   }
00529   return is;
00530 }
00531 
00532 template <class STREAM, class value_type, int DIM, int TDIM>
00533   STREAM& operator<<(STREAM& os, const BasisFunctionAdmin<value_type,DIM,TDIM>& b)
00534 {
00535   int i, j;
00536         
00537   i = b.size();
00538   os << i << "\n";
00539   for (j = 0;j < i;j ++) {
00540     os << "\t" << b.df->dof_index[j].dimension
00541        << b.df->dof_index[j].geometry_index << "\n";
00542     os << b[j] << "\n";
00543   }
00544   return os;
00545 }
00546 
00547 
00548 template <int DIM>
00549 class UnitOutNormal
00550 {
00551  public:
00552   enum { dim = DIM };
00553   typedef afepack::Point<DIM> point_t;
00554  private:
00555   void * handle; 
00556   std::string library_path;
00557   std::string library_name; 
00558   std::string function_name;
00559   void (*function)(const double *, const double **, int, double *);
00560  public:
00561   UnitOutNormal();
00562   UnitOutNormal(const UnitOutNormal<DIM>&);
00563   ~UnitOutNormal();
00564  public:
00565   UnitOutNormal<DIM>& operator=(const UnitOutNormal<DIM>&);
00566   void loadFunction();
00567   void unloadFunction();
00568   std::vector<double> value(const point_t&, 
00569                             const std::vector<point_t >&, const int&) const;
00570   std::vector<std::vector<double> > value(const std::vector<point_t >&, 
00571                                           const std::vector<point_t >&, const int&) const;
00572   std::vector<double> value(const point_t&, 
00573                             const double **, const int&) const;
00574   std::vector<std::vector<double> > value(const std::vector<point_t >&, 
00575                                           const double **, const int&) const;
00576   void readData(const std::string&); 
00577   void writeData(const std::string&) const; 
00579   DeclException1(ExcFileOpen, char *,
00580                  << "Can't open library "
00581                  << arg1);
00582   DeclException2(ExcLoadFunction, char *, char *,
00583                  << "Can't load function "
00584                  << arg1
00585                  << " from library "
00586                  << arg2);      
00587  public:
00588   template <class STREAM,int GDIM> 
00589     friend STREAM& operator>>(STREAM&, UnitOutNormal<GDIM>&); 
00590   template <class STREAM,int GDIM> 
00591     friend STREAM& operator<<(STREAM&, const UnitOutNormal<GDIM>&); 
00592 };
00593 
00594 template <class STREAM, int DIM>
00595   STREAM& operator>>(STREAM& is, UnitOutNormal<DIM>& c)
00596 {
00597   is >> c.library_name
00598      >> c.function_name;
00599         
00600   c.loadFunction();
00601   return is;
00602 }
00603 
00604 template <class STREAM, int DIM>
00605   STREAM& operator<<(STREAM& os, const UnitOutNormal<DIM>& c)
00606 {
00607   os << c.library_name << "\n\t"
00608      << c.function_name << "\n";
00609         
00610   return os;
00611 }
00612 
00618 template <class value_type, int DIM, int TDIM=DIM>
00619   class TemplateElement
00620   {
00621   public:
00622   typedef value_type value_t;
00623   enum { dim = DIM, tdim = TDIM };
00624   typedef afepack::Point<DIM> point_t;
00625   typedef afepack::Point<TDIM> ref_point_t;
00626   typedef TemplateGeometry<TDIM> geometry_t;
00627   typedef CoordTransform<TDIM,DIM> coord_trans_t;
00628   typedef BasisFunction<value_t,DIM,TDIM> basis_func_t;
00629   typedef TemplateElement<value_t,DIM,TDIM> template_t;
00630   typedef QuadratureInfoAdmin<TDIM> quad_info_t;
00631   typedef UnitOutNormal<DIM> unit_normal_t;
00632 
00633   private:
00634   typedef BasisFunctionAdmin<value_type,DIM,TDIM> basis_func_admin_t;
00635 
00636   geometry_t * geo; 
00637   TemplateDOF<TDIM> * df; 
00638   coord_trans_t * ct; 
00639   basis_func_admin_t * bf; 
00640   unit_normal_t * uon; 
00641   public:
00642   TemplateElement(geometry_t& = *((geometry_t*)NULL),
00643                   TemplateDOF<TDIM>& = *((TemplateDOF<TDIM> *)NULL), 
00644                   coord_trans_t& = *((coord_trans_t *)NULL),
00645                   basis_func_admin_t& = *((basis_func_admin_t *)NULL),
00646                   unit_normal_t& = *((unit_normal_t *)NULL)); 
00647   TemplateElement(const template_t&); 
00648   ~TemplateElement(); 
00649   public:
00650   template_t& operator=(const template_t&); 
00651   void reinit(geometry_t& = *((geometry_t*)NULL),
00652               TemplateDOF<TDIM>& = *((TemplateDOF<TDIM> *)NULL), 
00653               coord_trans_t& = *((coord_trans_t *)NULL),
00654               basis_func_admin_t& = *((basis_func_admin_t *)NULL),
00655               unit_normal_t& = *((unit_normal_t *)NULL)); 
00657   const geometry_t& geometry() const {return *geo;}
00659   geometry_t& geometry() {return *geo;}
00661   const TemplateDOF<TDIM>& dof() const {return *df;}
00663   TemplateDOF<TDIM>& dof() {return *df;}
00665   const coord_trans_t& coordTransform() const {return *ct;}
00667   coord_trans_t& coordTransform() {return *ct;}
00669   const basis_func_admin_t& basisFunction() const {return *bf;}
00671   basis_func_admin_t& basisFunction() {return *bf;}
00673   const basis_func_t& basisFunction(const int& i) const {return (*bf)[i];}
00675   basis_func_t& basisFunction(const int& i) {return (*bf)[i];}
00676 
00678   const std::vector<ref_point_t >& vertexArray() const;
00680   const quad_info_t& quadratureInfo() const {return geo->quadratureInfo();}
00682   quad_info_t& quadratureInfo() {return geo->quadratureInfo();}
00683   const unit_normal_t& unitOutNormal() const {return *uon;}
00684   unit_normal_t& unitOutNormal() {return *uon;}
00686   const QuadratureInfo<TDIM>& findQuadratureInfo(const int& i) const {return geo->findQuadratureInfo(i);}
00688   double volume() const {return geo->volume();}
00689   int n_dof() const {return df->n_dof;}
00690   };
00691 
00692 
00694 
00695 
00704 template <int DIM>
00705 struct GeometryAdditionalData 
00706 {
00707 public:
00708   int n_quadrature_point;
00709   double volume;
00710   afepack::Point<DIM> bc;
00711   std::vector<double> Jxw;
00712   std::vector<afepack::Point<DIM> > q_point;
00713 };
00714 
00715 #endif //_TemplateElement_h_
00716 
00717 //
00718 // end of file