bridging.h

Go to the documentation of this file.
00001 /* ./bridging/bridging.h 
00002 **********************************
00003 Copyright INRIA and CEA 
00004 
00005 author : Guillaume ANCIAUX (anciaux@labri.fr, g.anciaux@laposte.net)
00006 
00007 The LibMultiScale is a C++ parallel framework for the multiscale
00008 coupling methods dedicated to material simulations. This framework
00009 provides an API which makes it possible to program coupled simulations
00010 and integration of already existing codes.
00011 
00012 This Project is done in a collaboration between INRIA Futurs Bordeaux
00013 within ScAlApplix team and CEA/DPTA Ile de France. 
00014 
00015 This software is governed by the CeCILL-C license under French law and
00016 abiding by the rules of distribution of free software.  You can  use, 
00017 modify and/ or redistribute the software under the terms of the CeCILL-C
00018 license as circulated by CEA, CNRS and INRIA at the following URL
00019 "http://www.cecill.info". 
00020 
00021 As a counterpart to the access to the source code and  rights to copy,
00022 modify and redistribute granted by the license, users are provided only
00023 with a limited warranty  and the software's author,  the holder of the
00024 economic rights,  and the successive licensors  have only  limited
00025 liability. 
00026 
00027 In this respect, the user's attention is drawn to the risks associated
00028 with loading,  using,  modifying and/or developing or reproducing the
00029 software by the user in light of its specific status of free software,
00030 that may mean  that it is complicated to manipulate,  and  that  also
00031 therefore means  that it is reserved for developers  and  experienced
00032 professionals having in-depth computer knowledge. Users are therefore
00033 encouraged to load and test the software's suitability as regards their
00034 requirements in conditions enabling the security of their systems and/or 
00035 data to be ensured and,  more generally, to use and operate it in the 
00036 same conditions as regards security. 
00037 
00038 The fact that you are presently reading this means that you have had
00039 knowledge of the CeCILL-C license and that you accept its terms.
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       //      Boule & b = (Boule &)geom;
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       //      DUMP("le recouvrement trouve : [" << b.Rmin() << "," << b.Rmax() << "]");
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

Generated on Fri Sep 7 13:12:32 2007 for LibMultiScale by  doxygen 1.5.2