Page MenuHomec4science

bridging.hh
No OneTemporary

File Metadata

Created
Thu, Aug 22, 00:48

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 "bridging_interface.hh"
#include "compute_compatibility.hh"
#include "container_array.hh"
#include "dof_association.hh"
#include "filter_compatibility.hh"
#include "filter_geometry.hh"
#include "lib_continuum.hh"
#include "lib_dd.hh"
#include "lib_md.hh"
#include "shape_matrix.hh"
#include "spatial_grid_libmultiscale.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/** TODO : review doc */
template <typename ContainerPoints, typename ContainerMesh>
class Bridging : public BridgingInterface,
public DofAssociation<ContainerPoints, ContainerMesh> {
public:
using ContainerPointsSubset = typename ContainerPoints::ContainerSubset;
using ContainerMeshSubset = typename ContainerMesh::ContainerSubset;
Bridging(const std::string &name, ContainerPoints &cP, ContainerMesh &cM);
virtual ~Bridging();
//! extract identical nodes from the pbc pair lists
void setPBCPairs(std::vector<std::pair<UInt, UInt>> &pairs) {
pbc_pairs = pairs;
};
ShapeMatrix<ContainerPoints::Dim> &getShapeMatrix() {
LM_ASSERT(smatrix, "internal error: shape matrix was not implemented");
return *smatrix;
};
void declareParams();
//! sends the buffer array of atomic DOFs from GROUP_FROM to GROUP_DEST
void communicateBufferAtom2Continuum(ContainerArray<Real> &buf);
void communicateBufferAtom2Continuum() {
communicateBufferAtom2Continuum(this->buffer);
}
void communicateBufferContinuum2Atom(ContainerArray<Real> &buf);
void communicateBufferContinuum2Atom() {
communicateBufferContinuum2Atom(this->buffer);
}
//! internal function that synch the buffer array of atomic DOFs by sum
void synchSumBuffer(ContainerArray<Real> &buf);
void synchSumBuffer() { synchSumBuffer(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);
//! 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> &, UInt, const char *,
UInt = 1){};
//! cumulate values due to PBC conditions
virtual void cumulPBC(ContainerArray<Real> &data);
//! 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(ContainerArray<Real> &v);
//! Perform a leastsquare on a set of atoms returning and nodal array
virtual void leastSquarePointData(ContainerArray<Real> &v_out,
ContainerArray<Real> &data_atom, UInt nmax);
//! SolvePerform a leastsquare on a set of atoms returning and nodal array
void solveLeastSquare(ContainerArray<Real> &mesh_data,
ContainerArray<Real> &atomic_data);
//! create an array with interpolated field on atomic sites
void interpolatePointData(ContainerArray<Real> &data_atom,
ContainerArray<Real> &data_node);
//! average poUInt data per elements
void averageOnElements(ContainerArray<Real> &data_point,
ContainerArray<Real> &data_mesh);
//! attach a vector to the bridging zone (coherency will thus be maintained
//! through atomic migrations)
void attachVector(ContainerArray<Real> &tab, const std::string &name);
//! 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();
//! 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(ContainerArray<Real> &array);
private:
//! convert node indexes to list of nodal references
void buildNodeList();
public:
//! contains the atoms filtered by geometry
casted_component<FilterGeometry>::cast<ContainerPointsSubset>
unmatchedPointList;
//! contains the atoms to be coupled
FilterCompatibility<ContainerPointsSubset> pointList;
//! contains the nodes&elements filtered by geometry
casted_component<FilterGeometry>::cast<ContainerMeshSubset> unmatchedMeshList;
//! contains the nodes&elements to be coupled
FilterCompatibility<ContainerMeshSubset> meshList;
//! node shape vector
ComputeCompatibility node_shape;
private:
//! shape matrix (containing interpolation values of the initial atomic sites)
ShapeMatrix<ContainerPoints::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
ContainerArray<Real> buffer;
//! Container of points
ContainerPoints &contPoints;
//! Container of nodes
ContainerMesh &contMesh;
};
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_BRIDGING_HH__ */

Event Timeline