Page MenuHomec4science

bridging.hh
No OneTemporary

File Metadata

Created
Wed, Aug 7, 02:52

bridging.hh

/**
* @file bridging.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Fri Jul 11 15:47:44 2014
*
* @brief Bridging object between atomistic and finite elements
*
* @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 __LIBMULTISCALE_BRIDGING_HH__
#define __LIBMULTISCALE_BRIDGING_HH__
/* -------------------------------------------------------------------------- */
#include "dof_association.hh"
#include "container_array.hh"
#include "lib_continuum.hh"
#include "lib_md.hh"
#include "lib_dd.hh"
#include "shape_matrix.hh"
#include "spatial_grid_libmultiscale.hh"
#include "filter_geometry.hh"
#include "filter_compatibility.hh"
#include "compute_compatibility.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/** this class represent a low-level bridging zone. The Belytschko Method
for instance is based on it.
association between points and elements and the shape values through the smatrix object
are built by this method
*/
template <typename ContainerPoints,
typename ContainerMesh,UInt Dim>
class Bridging : public DofAssociation<ContainerPoints,ContainerMesh,Dim> {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
Bridging<ContainerPoints,ContainerMesh,Dim>(const std::string & name,
ContainerPoints & cP,
ContainerMesh & cM);
virtual ~Bridging();
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
public:
typedef typename ContainerPoints::Ref RefPoint;
typedef typename ContainerPoints::iterator IteratorPoints;
typedef typename ContainerMesh::ContainerElems::Ref RefElem;
typedef UInt RefIndexNode;
typedef typename ContainerMesh::ContainerNodes::Ref RefNode;
typedef typename ContainerMesh::ContainerElems::iterator IteratorElems;
typedef typename ContainerMesh::ContainerNodes::iterator IteratorNodes;
typedef typename ContainerPoints::ContainerSubset ContainerPointsSubset;
typedef typename ContainerMesh::ContainerSubset ContainerMeshSubset;
typedef typename ContainerArray<RefNode>::iterator IteratorNodesSubset;
typedef typename ContainerArray<RefIndexNode>::iterator IteratorNodesIndexSubset;
typedef typename ContainerArray<RefElem>::iterator IteratorElemsSubset;
typedef typename ContainerArray<RefPoint>::iterator IteratorPointsSubset;
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
//! extract identical nodes from the pbc pair lists
void setPBCPairs(std::vector< std::pair<UInt ,
UInt > > & pairs){
pbc_pairs = pairs;
};
ShapeMatrix<Dim> & getShapeMatrix(){
LM_ASSERT(smatrix,"internal error: shape matrix was not implemented");
return *smatrix;
};
void declareParams();
/* ------------------------------------------------------------------------ */
/* Parallel Methods */
/* ------------------------------------------------------------------------ */
//! sends the buffer array of atomic DOFs from GROUP_FROM to GROUP_DEST
void communicateBufferAtom2Continuum(UInt stride, std::vector<Real> & buf);
void communicateBufferAtom2Continuum(UInt stride){
communicateBufferAtom2Continuum(stride,this->buffer);
}
void communicateBufferContinuum2Atom(UInt stride, std::vector<Real> & buf);
void communicateBufferContinuum2Atom(UInt stride){
communicateBufferContinuum2Atom(stride,this->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,this->buffer);
};
//! function to call to synch migrated data along with atoms
virtual void updateForMigration();
//! filter duplicate owners info from A processors
void filterRejectedContinuumOwners(std::vector<std::vector<UInt> > & unassociated_points);
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
//! method to clear every data or object allocated (for a reuse)
virtual void clearAll();
//! Init this object : select DOFs, associate them and compute shapematrix
virtual void init();
//! build node_shape vector \sum_i \varphi_I(X_i)
void buildNodeShape();
//! unfragmenting an attached vector
virtual void UnfragmentArray(std::vector<Real> & tab,UInt nmax, const char * name,UInt stride=1){};
//! cumulate values due to PBC conditions
virtual void cumulPBC(std::vector<Real> & data,UInt stride=1);
//! cumulate values due to PBC conditions in the case of full scalar matrix
virtual void cumulPBC(math::Matrix & mat);
//! force slave values to be master values in pbc handling
virtual void copySlaveValues(std::vector<Real> & v, UInt stride);
//! Perform a leastsquare on a set of atoms returning and nodal array
virtual void leastSquarePointData(std::vector<Real> & v_out,std::vector<Real> & data_atom,
UInt stride,UInt nmax);
//! SolvePerform a leastsquare on a set of atoms returning and nodal array
void solveLeastSquare(std::vector<Real> & mesh_data,std::vector<Real> & atomic_data,
UInt field);
//! create an array with interpolated field on atomic sites
void interpolatePointData(std::vector<Real> & data_atom, std::vector<Real> & data_node,
UInt stride);
//! average poUInt data per elements
void averageOnElements(std::vector<Real> & data_point,std::vector<Real> & data_mesh,
UInt stride=1);
//! attach a vector to the bridging zone (coherency will thus be maintained through atomic migrations)
void attachVector(std::vector<Real> & tab,const std::string & name,UInt stride=1);
//! extract identical nodes from the pbc pair lists
void buildLocalPBCPairs();
//! internal function that filter the interesting MD DOFs and compute weights
void buildPointList();
//! internal function that compute the association vector and smatrix associated
void buildShapeMatrix(UInt nb_points);
//! filter an atomic container in order not to take into account unmatched atoms
void filterPointListForUnmatched();
//! build the full leastsquare matrix (works in sequential only)
void buildLeastSquareMatrix(math::Matrix & mat);
//! extract the complete shape matrix
void extractShapeMatrix(math::Matrix & mat);
protected:
//! internal function that filter the interesting FE DOFs and compute weights
void buildContinuumDOFsList();
//! buffer array nedded for communications is allocated by this function
void allocateBuffer(UInt size,UInt stride);
//! filter a container (elems_rec or nodes_rec for instance) in order not to take into account unmatched elements/nodes from BuildShapeMatrix
void filterContainerElems(std::vector<UInt > & nb_atome_par_element);
//! filter an atomic array associated with the detected atoms in the bridging zone
void filterArray(std::vector<Real> & array,UInt stride=1);
private:
//! convert node indexes to list of nodal references
void buildNodeList();
protected:
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
public:
//! generic container that contains the atoms references filtered based on geometry
FilterGeometry<ContainerPoints> unmatchedPointList;
//! generic container that contains the atoms references that need to be coupled
FilterCompatibility<ContainerPointsSubset> pointList;
//! generic container that contains the nodes and element references that need to be coupled
FilterGeometry<ContainerMesh> unmatchedMeshList;
//! generic container that contains the nodes and element references that need to be coupled
FilterCompatibility<ContainerMeshSubset> meshList;
//! node shape vector
ComputeCompatibility<> node_shape;
private:
//! shape matrix (containing interpolation values of the initial atomic sites)
ShapeMatrix<Dim> * smatrix;
protected:
//! number of associations made by BuildShapeMatrix method
UInt assoc_found;
//node fusion info for PBC in mesh (temporary)
std::vector< std::pair<UInt ,UInt > > local_pbc_pairs;
//! pbc pairs object
std::vector< std::pair<UInt ,UInt > > pbc_pairs;
//! buffer array for projection and/or other purpose
std::vector<Real> buffer;
//! Container of points
ContainerPoints & contPoints;
//! Container of nodes
ContainerMesh & contMesh;
};
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_BRIDGING_HH__ */

Event Timeline