Go to the documentation of this file.00001 #pragma once
00002
00003 #include <vector>
00004 #include <map>
00005 #include <iostream>
00006 #include "limits"
00007 #include "formula/elementFormulaRCP.hh"
00008 #include "space/space.hh"
00009 #include "geometry/mesh.hh"
00010 #include "hp2D/quad.hh"
00011 #include "gfemControl.h"
00012 #include "gfemSpace.h"
00013 #include "gfemQuadFast.h"
00014
00015
00016
00017 namespace concepts {
00018 namespace gfem {
00019
00020 class GfemSpaceFast : public concepts::SpaceOnCells<Real>
00021 {
00022 public:
00023 typedef hp2D::Quad<Real> hpQuad;
00024 typedef StlVectorScan<ElementWithCell<Real> > Scan;
00025 typedef StlVectorScan<GfemQuadFast > ScanGfem;
00026 typedef StlVectorScan<hpQuad > ScanOrdinary;
00027
00028 const static bool NO_SCALE_RES = GfemControl<0>::NO_SCALE_RES;
00029 const static bool USE_SCALE_RES = GfemControl<0>::USE_SCALE_RES;
00030
00031
00041 GfemSpaceFast(Mesh2& msh, const Unitcell& uc, const GfemSpaceParams& params,
00042 const concepts::BoundaryConditions& bc);
00043
00044 virtual ~GfemSpaceFast();
00045
00046 void rebuild();
00047
00049 virtual uint dim() const {
00050 return dim_;
00051 }
00052
00053 int getDim() {
00054 return dim();
00055 }
00056
00057 int getDimGfem() const {
00058 return dimGfem;
00059 }
00060
00061 int getDimOverl() const {
00062 return dimOverl;
00063 }
00064
00065 int genVertDof(GfemControlVert ctrl);
00066
00070 virtual uint nelm() const {
00071 return elems.size();
00072 }
00073
00074 void clear();
00075
00076 int getNelm() const {
00077 return elems.size();
00078 }
00079
00080 int getNelmGfem() const {
00081 return elemGfemSubs.size();
00082 }
00083
00084 int getNelmOrdinary() const {
00085 return elemGfemSubs.size();
00086 }
00087
00089 virtual Scan* scan() const {
00090 return new Scan(elems, elems.begin());
00091 }
00092
00093
00094 ScanOrdinary* scanOrdinary() const {
00095 return new ScanOrdinary(elemOrdinarySubs, elemOrdinarySubs.begin());
00096 }
00097
00098 ScanGfem* scanGfem() const {
00099 return new ScanGfem(elemGfemSubs, elemGfemSubs.begin());
00100 }
00101
00102
00103 void assignVertexDofs(const concepts::Quad& cell_t, const GfemOverlapCondition& overc,
00104 concepts::TColumn<Real>*& T1);
00105
00106 void assignEdgeDofs(const concepts::Quad& cell_t, const GfemOverlapCondition& overc,
00107 concepts::TColumn<Real>*& T1);
00108
00109 void assignInnerDofs(const concepts::Quad& cell_t, const GfemOverlapCondition& overc,
00110 concepts::TColumn<Real>*& T1);
00111
00113 bool isVertexDof(const concepts::Connector2& cntr, uint i) const;
00114
00119 bool isEdgeDof(const concepts::Connector2& cntr, uint i) const;
00120
00125 bool isInnerDof(const concepts::Connector2& quad) const;
00126
00127 void verbosePrint();
00128
00132 void recomputeShapefunctions();
00133
00134 void registerFormula(const RCP<const concepts::ElementFormula<Cmplx> >& formula,
00135 GfemUCQuad::EvalMode mode = GfemUCQuad::EVAL_ON_MICRO)
00136 {
00137 if(dim() == 0) {
00138 throw ExceptionBase(__FILE__, __LINE__, __FUNCTION__, "need to rebuild space first");
00139 }
00140 if(isMicroStructureMesh()) {
00141 ucQ->registerFormula(formula, mode);
00142 } else {
00143 printf("no microstructure mesh2 ...\n");
00144 }
00145 }
00146
00147 protected:
00148 virtual std::ostream& info(std::ostream& os) const;
00149
00153 int allocDofs(int numDofs);
00154
00155 bool isMicroStructureMesh() {
00156 return microStructureMesh;
00157 }
00158 private:
00159
00160 void processMesh(const Quad2d& quad);
00161
00162 void processMicro(const Quad2d& quad);
00163
00164 void processOverlap(const Quad2d& cell);
00165
00166 void processBC(const Quad2d& quad);
00167
00169 concepts::Mesh2& mesh;
00170 bool microStructureMesh;
00171
00172 RCP<GfemUCQuad> ucQ;
00173 std::vector< ElementWithCell<Real>* > elems;
00174 std::vector< GfemQuadFast* > elemGfemSubs;
00175 std::vector< hpQuad* > elemOrdinarySubs;
00177 typedef std::map< int, GfemControl<0> > ControlVert;
00178 typedef std::map< int, GfemControl<1> > ControlEdge;
00179 typedef std::map< int, GfemControl<2> > ControlCell;
00180 ControlVert controlVert;
00181 ControlEdge controlEdge;
00182 ControlCell controlCell;
00183
00184 int n_elem;
00185 int n_gfem;
00186 int n_ordinary;
00187 int dim_;
00188 int dimGfem;
00189 int dimOverl;
00190
00191 GfemSpaceParams params;
00192 BoundaryConditions bc;
00193 const Unitcell& uc;
00194
00195
00196 };
00197
00198 }
00199 }