bridging_par.h

Go to the documentation of this file.
00001 /* ./bridging/bridging_par.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 BRIDGINGPAR_H
00043 #define BRIDGINGPAR_H
00044 
00045 #include "duo_distributed_vector.h"
00046 #include "bridging.h"
00047 
00052 template <typename DomainA, typename DomainC,unsigned int Dim,int Pond>
00053 class BridgingPar : public Bridging<DomainA,DomainC,Dim,Pond> 
00054 {
00055 
00056  public:
00057   BridgingPar<DomainA,DomainC,Dim,Pond>(DomainAtomicInterface & A,DomainContinuumInterface & C,int geomID):
00058     Bridging<DomainA,DomainC,Dim,Pond>(A,C,geomID),communicateur(NULL)
00059     {
00060       total_atoms_in_rec=0;
00061       local_atoms_in_rec=0;
00062       total_atoms_fictifs=0;
00063       local_atoms_fictifs=0;
00064 
00065       correction_fictifs = NULL;
00066       GROUP_ID_ATOMS = A.GetGroupID();
00067       GROUP_ID_CONTINU = C.GetGroupID();
00068 
00069       centers = NULL;
00070       whole_atomes_par_proc = NULL;
00071       duo_vector = NULL;
00072       duo_vector_fictifs = NULL;
00073     };
00074 
00075   virtual ~BridgingPar(){
00076     if (correction_fictifs)
00077       delete [] correction_fictifs;
00078     
00079     if (whole_atomes_par_proc)
00080       delete [] whole_atomes_par_proc;
00081 
00082     if (duo_vector)
00083       delete duo_vector;
00084 
00085     if (duo_vector_fictifs)
00086       delete duo_vector_fictifs;
00087 
00088   }
00089 
00090   typedef Bridging<DomainA,DomainC,Dim,Pond> Parent;
00091 
00093   void SetCommunicator(Communicator * com,
00094                         int group_id_atoms,int group_id_continu){
00095     communicateur = com;
00096     GROUP_ID_CONTINU = group_id_continu;
00097     GROUP_ID_ATOMS = group_id_atoms;
00098   }
00099 
00100  protected:
00101 
00103   void GenerateCommunicationScheme();
00105   void UnfragmentScheme(DuoDistributedVecteur & duo);
00107   void UnfragmentIndirectionArrays(std::vector<int>  & assoc,ShapeMatrix<typename Parent::_Vec_,Dim> * smatrix,DuoDistributedVecteur & duo);
00109 #ifdef DEBUG_BRIDGE
00110   void UnfragmentArray(double * array,unsigned int nmax,unsigned int size,DuoDistributedVecteur & duo,unsigned int stride=1);
00111 #else
00112   void UnfragmentArray(double * array,unsigned int size,DuoDistributedVecteur & duo,unsigned int stride=1);
00113 #endif
00115   void UnfragmentContener(ContenerTableau<typename Parent::RefAtom> & atoms,DuoDistributedVecteur & duo);
00116 #ifdef USING_SCOTCH
00118   void DumpScotchPartition(int nb_atome,int * atomes_par_proc,DuoDistributedVecteur & duo);
00119 #endif
00120 
00122   virtual void CorrectSurfaceEffect();
00123 
00125   DuoDistributedVecteur * duo_vector;
00127   DuoDistributedVecteur * duo_vector_fictifs;
00128 
00130   Communicator * communicateur;
00131 
00133   int GROUP_ID_CONTINU;
00135   int GROUP_ID_ATOMS;
00136 
00138   unsigned int total_atoms_in_rec; 
00140   unsigned int local_atoms_in_rec;
00141 
00143   unsigned int total_atoms_fictifs;
00145   unsigned int local_atoms_fictifs;
00146 
00148   double * correction_fictifs;
00149 
00150  private:
00151 
00153   int * exchangeGeometries();
00155   int * exchangeAtomsRecPositions(int * com_with,unsigned int & local_atoms,unsigned int & total_atoms);
00157   DuoDistributedVecteur * ExchangeAssociationInformation(int * com_with,int * atomes_par_proc,
00158                                                          unsigned int local_atoms,unsigned int total_atoms,
00159                                                          std::vector<int> & association);
00160 
00161 
00162   int * whole_atomes_par_proc;  
00163   double * centers;
00164 };
00165 
00166 #endif //BRIDGING

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