Page MenuHomec4science

bridging_par.hh
No OneTemporary

File Metadata

Created
Fri, Aug 16, 08:41

bridging_par.hh

/**
* @file bridging_par.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Mon Oct 28 19:23:14 2013
*
* @brief Bridging object between atomistic and finite elements in its parallel version
*
* @section LICENSE
*
* Copyright INRIA and CEA
*
* The LibMultiScale is a C++ parallel framework for the multiscale
* coupling methods dedicated to material simulations. This framework
* provides an API which makes it possible to program coupled simulations
* and integration of already existing codes.
*
* This Project was initiated in a collaboration between INRIA Futurs Bordeaux
* within ScAlApplix team and CEA/DPTA Ile de France.
* The project is now continued at the Ecole Polytechnique Fédérale de Lausanne
* within the LSMS/ENAC laboratory.
*
* This software is governed by the CeCILL-C license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL-C
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*
*/
#ifndef BRIDGINGPAR_H
#define BRIDGINGPAR_H
/* -------------------------------------------------------------------------- */
#include "bridging_atomic_continuum.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/** Object that is implements a bridging zone with redistribution
facilities, such as auto detection, creation of the redistribution
objects (duodistributed vectors), and so on*/
template <typename DomainA, typename DomainC,UInt Dim>
class BridgingAtomicContinuumPar :
public virtual BridgingAtomicContinuum<DomainA,DomainC,Dim>
{
public:
/* -------------------------------------------------------------------------- */
// Typedefs
/* -------------------------------------------------------------------------- */
typedef BridgingAtomicContinuum<DomainA,DomainC,Dim> Parent;
/* -------------------------------------------------------------------------- */
// Constructor/Destructor
/* -------------------------------------------------------------------------- */
BridgingAtomicContinuumPar(DomainAtomicInterface & A,
DomainContinuumInterface & C,
GeomID geomID);
~BridgingAtomicContinuumPar();
/* -------------------------------------------------------------------------- */
// Public Methods
/* -------------------------------------------------------------------------- */
//! Init this object : select DOFs, associate them and compute shapematrix
void init();
//! ask to generate VTU files
void dump(const string & filename);
//! clear everything
virtual void clearAll();
protected:
//! generate the communication schemes by means of generating association, smatrix, duodistributed objects.
void generateCommunicationScheme();
//! method that check coherency of DOFs redistribution based on atomic positions
void CheckPositionCoherency();
//! project atomic DOFs on mesh interpolated solution
void projectAtomicDOFsOnMesh(FieldType field);
//! project atomic DOFs on mesh interpolated solution and fill the buffer for later use (author:Srinivasa Babu Ramisetti)
void projectAtomicDOFsOnMesh(FieldType field, std::vector<Real> & buffer);
//! average atomic velocities per elements
void averageDOFsOnElements(std::vector<Real> & data_mesh,FieldType field);
//! Perform a leastsquare on a set of atoms returning and nodal array
void leastSquareAtomicDOFs(std::vector<Real> & data_mesh,FieldType field);
//! Perform a leastsquare on a set of atoms returning and nodal array
void leastSquareAtomicData(std::vector<Real> & data_mesh,std::vector<Real> & data_atom,UInt stride);
//! function to call to synch migrated data along with atoms
void updateForMigration();
//! build atomic DOFs vector noise (u-sum_I \varphi_I u_I)
void buildAtomicDOFsNoiseVector(std::vector<Real> & v_out,FieldType field);
//! simple research of a given atom by coordinates and prUInt out ref to screen
void searchAtomInLocalPool(typename Parent::ContainerPointsSubset & container,
Real x,Real y,Real z);
//! exchange geometries: for coarse desc of redistribution communication scheme
void exchangeGeometries(Cube & c);
//! exchange atoms positions following coarse description
void exchangeAtomsBridgePositions();
//! exchange association information for full communication scheme description
DuoDistributedVector * ExchangeAssociationInformation(std::vector<std::vector<UInt> > &
unassociated_atoms);
//! exchange duplicate owners info from atomic processors to continuum ones
void exchangeRejectedContinuumOwners(std::vector<std::vector<UInt> > & unassociated_atoms);
//! filter duplicate owners info from atomic processors
DuoDistributedVector * FilterRejectedContinuumOwners(std::vector<std::vector<UInt> > &
unassociated_atoms);
//! sends the buffer array of atomic DOFs from GROUP_FROM to GROUP_DEST
void communicateBuffer(UInt GROUP_FROM,UInt GROUP_DEST, UInt stride,
std::vector<Real> & buf);
void communicateBuffer(UInt GROUP_FROM,UInt GROUP_DEST, UInt stride){
communicateBuffer(GROUP_FROM,GROUP_DEST,stride,Parent::buffer);
}
//! internal function that synch the buffer array of atomic DOFs by sum
void synchSumBuffer(UInt stride,std::vector<Real> & buf);
void synchSumBuffer(UInt stride){
synchSumBuffer(stride,Parent::buffer);
}
/* -------------------------------------------------------------------------- */
// Members
/* -------------------------------------------------------------------------- */
//! group ID of the continuum side
UInt GROUP_ID_CONTINUUM;
//! group IF of the atomic side
UInt GROUP_ID_ATOMS;
//! total atoms in the bridged zone (needs a REDUCING operation to be computed)
UInt total_atoms;
// UInt * whole_atoms_per_proc;
//! array that specifies what processor I should communicate with
std::vector<UInt> com_with;
//! array that specifies the number of atoms per proc
std::vector<UInt> atoms_per_proc;
};
/* -------------------------------------------------------------------------- */
template <typename DomainA, typename DomainC,UInt Dim>
BridgingAtomicContinuumPar<DomainA,DomainC,Dim>::
BridgingAtomicContinuumPar(DomainAtomicInterface & A,
DomainContinuumInterface & C,
GeomID geomID):
BridgingAtomicContinuum<DomainA,DomainC,Dim>(A,C,geomID) {
total_atoms=0;
GROUP_ID_ATOMS = A.getGroupID();
GROUP_ID_CONTINUUM = C.getGroupID();
DUMP("GROUP_ID_ATOMS is " << GROUP_ID_ATOMS,DBG_INFO_STARTUP);
DUMP("GROUP_ID_CONTINUUM is " << GROUP_ID_CONTINUUM,DBG_INFO_STARTUP);
//whole_atoms_per_proc = NULL;
};
/* -------------------------------------------------------------------------- */
template <typename DomainA, typename DomainC,UInt Dim>
BridgingAtomicContinuumPar<DomainA,DomainC,Dim>::~
BridgingAtomicContinuumPar(){
clearAll();
}
/* -------------------------------------------------------------------------- */
template <typename DomainA, typename DomainC,UInt Dim>
void BridgingAtomicContinuumPar<DomainA,DomainC,Dim>::
clearAll(){
/* if (whole_atoms_per_proc) */
/* delete [] whole_atoms_per_proc; */
/* whole_atoms_per_proc = NULL; */
if (Parent::duo_vector){
if(Communicator::getCommunicator().amIinGroup(GROUP_ID_ATOMS)){
DUMP("detaching duo_vector",DBG_MESSAGE);
Parent::domA.getRefManager().
detachObject(*Parent::duo_vector,*this->pointList);
}
delete Parent::duo_vector;
Parent::duo_vector = NULL;
}
total_atoms=0;
Parent::clearAll();
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif //BRIDGING

Event Timeline