00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef BRIDGING_H
00043 #define BRIDGING_H
00044
00045 #include "bridging_interface.h"
00046 #include "shape_matrix.h"
00047 #include "ponderation.h"
00048 #include "../geometry/spatial_grid.h"
00049
00054 template <typename DomainA, typename DomainC,unsigned int Dim,int Pond>
00055 class Bridging : public BridgingInterface {
00056
00057 public:
00058 Bridging<DomainA,DomainC,Dim,Pond>(DomainAtomicInterface & A,DomainContinuumInterface & C,int geomID):
00059 domC(static_cast<DomainC &>(C)),domA(static_cast<DomainA &>(A)),
00060 geom(GeomTools::Intersection(C.Geom(),A.Geom())),
00061 geom_fictif(static_cast<DomainA &>(A).GeomBoundary()),
00062 LocalGeom(Dim),
00063 atomes_rec(domA.getRefManager().RequestCreationSubSet("atomes_rec_subset")),atomes_fictifs(domA.getRefManager().RequestCreationSubSet("atomes_fictifs_subset")),
00064 P(*GeometryManager::GetGeometry(geomID))
00065 {
00066 DUMP("DUMP de la geometrie du recouvrement : \n" << geom,DBG_INFO);
00067
00068 positions = NULL;
00069 assoc_found = 0;
00070 assoc_found_fictifs = 0;
00071 Smatrix = NULL;
00072 Smatrix_fictifs = NULL;
00073
00074 lambdasC= NULL;
00075 lambdasA = NULL;
00076
00077
00078
00079 int temp =14;
00080 if (Dim == 1)
00081 temp = 1;
00082 if (Dim == 3)
00083 temp =15;
00084
00085 division_grille[0] = temp;
00086 division_grille[1] = temp;
00087 division_grille[2] = temp;
00088
00089 nb_partitions = 0;
00090 };
00091
00092 virtual ~Bridging(){
00093 delete &geom;
00094 if (lambdasC)
00095 delete [] lambdasC;
00096 if (lambdasA)
00097 delete [] lambdasA;
00098 if (Smatrix)
00099 delete Smatrix;
00100 if (Smatrix_fictifs)
00101 delete Smatrix_fictifs;
00102 }
00103
00105 double *lambdasC;
00107 double *lambdasA;
00108
00110 DomainC & domC;
00112 DomainA & domA;
00113
00115 Geometrie & geom;
00118 Geometrie & geom_fictif;
00119
00121 Cube LocalGeom;
00122
00123 typedef typename DomainA::RefDof RefAtom;
00124 typedef typename DomainA::ContenerDofs ContenerAtoms;
00125 typedef typename DomainA::IteratorDofs IteratorAtoms;
00126
00127 typedef typename DomainC::RefElt RefElt;
00128 typedef unsigned int RefNode;
00129 typedef typename DomainC::_Vec_ _Vec_;
00130 typedef typename DomainC::ContenerElems ContenerElems;
00131 typedef typename DomainC::IteratorElems IteratorElems;
00132
00133 typedef ContenerTableauRefAtome<RefAtom> ContenerAtomsRec;
00134 typedef ContenerTableauBaseType<RefNode> ContenerNodesRec;
00135 typedef ContenerTableau<typename DomainC::RefElt> ContenerElemsRec;
00136
00137 typedef IteratorTableauBaseType<RefNode> IteratorNodesRec;
00138 typedef IteratorTableau<RefElt> IteratorElemsRec;
00139 typedef IteratorTableau<RefAtom> IteratorAtomsRec;
00140
00142 void Dump(char * prefix);
00144 void Dump(char * file,ContenerTableau<RefAtom> & atomes,bool dumpWeights);
00146 void Dump(char * file,std::vector<double> & atomes_positions,std::vector<int> & suppfield);
00148 void Dump(char * file,std::vector<double> & atomes_positions,int * suppfield=NULL);
00150 void Dump(char * file,
00151 ContenerNodesRec & nodes,
00152 ContenerElemsRec & elems,bool dumpWeights);
00153
00154
00155 void SetParam(char * key,double value);
00156
00157 protected:
00158
00160 void DumpDistance();
00161
00163 void BuildContinuWeight();
00165 void BuildAtomsWeight();
00167 void BuildShapeMatrix(double * positions,unsigned int nb_atoms);
00169 void BuildShapeMatrixFictifs(double * positions,unsigned int nb_atoms);
00171 virtual void CorrectSurfaceEffect();
00173 void BuildPositions();
00175 void BuildFictifsPositions();
00176
00178 std::vector<int> assoc;
00180 std::vector<int> assoc_fictifs;
00181
00183 ShapeMatrix<_Vec_,Dim> * Smatrix;
00185 ShapeMatrix<_Vec_,Dim> * Smatrix_fictifs;
00186
00188 ContenerAtomsRec & atomes_rec;
00190 ContenerNodesRec noeuds_rec;
00192 ContenerElemsRec elems_rec;
00194 ContenerElemsRec elems_fictifs;
00196 ContenerNodesRec noeuds_fictifs;
00198 ContenerAtomsRec & atomes_fictifs;
00199
00201 Ponderation<Pond> P;
00202
00204 double * positions;
00206 unsigned int assoc_found;
00208 unsigned int assoc_found_fictifs;
00209
00211 SpatialGrid<int,_Vec_,Dim> * grid;
00213 SpatialGrid<int,_Vec_,Dim> * grid_fictifs;
00214
00215
00217 void DumpAtome(double x,double y,double z);
00219 void rebuildAssoc(std::vector<int> & assoc);
00221 void filterContener(ContenerAtomsRec & atoms,std::vector<int> & v);
00223 void filterContenerElemsAndNodes(std::vector<unsigned int> & nb_atome_par_element,
00224 ContenerElemsRec & elems,ContenerNodesRec & nodes,std::vector<int> & a,
00225 double * lambda=NULL);
00227 #ifdef DEBUG_BRIDGE
00228 void filterArray(double * array,unsigned int nmax,std::vector<int> & v);
00229 #else
00230 void filterArray(double * array,std::vector<int> & v);
00231 #endif
00232
00233 int division_grille[3];
00234
00235 int nb_partitions;
00236 };
00237
00238 #endif //BRIDGING