domain_atomic.cpp

Go to the documentation of this file.
00001 /* ./md/domain_atomic.cpp 
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 #include "../common/common.h"
00043 
00044 #define NEED_STAMP
00045 #define NEED_PROTOMOL
00046 #define NEED_LAMMPS
00047 #define NEED_MD1D
00048 #define LOCAL_MODULE MOD_MD
00049 #include "domain_atomic.h"
00050 #ifdef USING_STAMP
00051 #include "stamp/contener_stamp.h"
00052 #endif //STAMP
00053 #ifdef USING_LAMMPS
00054 #include "lammps/contener_lammps.h"
00055 #endif //LAMMPS
00056 #ifdef USING_MD1D
00057 #include "1d/contener_md1d.h"
00058 #endif //MD1D
00059 #include "dummy/domain_dummymd.h"
00060 
00061 template <typename C>
00062 inline void DomainAtomic<C>::TestGeometryCoherence(){
00063     typedef typename C::IteratorType IteratorAtoms;
00064     typedef typename C::Ref Ref;
00065 
00066     IteratorAtoms it = atoms.GetIterator();
00067     Ref at = it.GetFirst();
00068     // teste si tout les atomes sont bien dans la geometrie definie
00069     while (!it.end())
00070       {
00071         //      if (!geom.Contient(at.position0()[0],at.position0()[1],at.position0()[2])){
00072         if (!geom.Contient(at.position0(0))){
00073           FATAL("atom at position " << FORMATREAL(at.position0(0)) << " pas dans la geometrie");
00074         }
00075         at = it.GetNext();
00076       }
00077 }
00078 
00079 
00080 template <typename C>
00081 inline void DomainAtomic<C>::ReadXMLFile(char * filename){
00082   XMLRestartParser parser;
00083 
00084   DUMP("Setting Dummy simulation from libMultiScale XML Data format " << filename,DBG_INFO);
00085   parser.ParseFile(filename);
00086   DUMP("read done " << filename,DBG_INFO);
00087 
00088   typename C::_Iterator & it = atoms.GetIterator();
00089   Ref at = it.GetFirst();
00090 
00091   UnitsConverter unit;
00092   unit.SetReadUnits(UnitsConverter::AtomsUnits);
00093     
00094   int cpt=0;
00095   int cpt2=0; 
00096   int total = atoms.nbElem();
00097   //LOG("total = " << total);
00098 
00099   for (at = it.GetFirst(); !it.end() ; at = it.GetNext()){
00100     double x=0,y=0,z=0;
00101       
00102     x = at.position0(0);
00103     y = at.position0(1);
00104     z = at.position0(2);
00105 
00106     if (cpt2%100 == 0) DUMP("passing atom number " << cpt2 << "/" << total << " reloaded",DBG_INFO);
00107     ++cpt2;
00108     if (!parser.IsDofRegistered(x,y,z)) continue;
00109       
00110     double ux,uy,uz;
00111     parser.AssignDispField(x,y,z,ux,uy,uz);
00112       
00113     at.position(0) = at.position0(0) + ux;
00114     at.position(1) = at.position0(1) + uy;
00115     at.position(2) = at.position0(2) + uz;
00116 
00117     parser.AssignVelField(x,y,z,at.vitesse(0),at.vitesse(1),at.vitesse(2));
00118     parser.AssignForceField(x,y,z,at.force(0),at.force(1),at.force(2));
00119     if (cpt%100 == 0) DUMP("atom number " << cpt << "/" << total << " reloaded",DBG_INFO);
00120     ++cpt;
00121   }
00122 
00123 
00124   DUMP("associated " << cpt << " over " << atoms.nbElem(),DBG_INFO);
00125 };
00126 
00127 
00128 
00129 #ifdef USING_STAMP
00130 template class DomainAtomic<ContenerStamp>;
00131 #endif
00132 #ifdef USING_LAMMPS
00133 template class DomainAtomic<ContenerLammps>;
00134 #endif
00135 template class DomainAtomic<ContenerMD1D>;
00136 template class DomainAtomic<ContenerDummy>;
00137 

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