Page MenuHomec4science

bridging.hh
No OneTemporary

File Metadata

Created
Tue, Jul 2, 03:16

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 "compute_compatibility.hh"
#include "container_array.hh"
#include "dof_association.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 */
class Bridging : public DofAssociation {
//****************************************************************
// non templated functions
//****************************************************************
public:
// using ContainerPointsSubset = typename ContainerPoints::ContainerSubset;
// using ContainerMeshSubset = typename ContainerMesh::ContainerSubset;
Bridging(const std::string &name);
virtual ~Bridging();
// return the number of points bridged with elements
UInt getNumberPoints();
// return the number of elements bridged with points
UInt getNumberElems();
// return the number of nodes belonging to elements bridged with points
UInt getNumberNodes();
//! build the full leastsquare matrix (works in sequential only)
template <typename SparseMatrix>
void buildLeastSquareMatrix(SparseMatrix &mat);
//! extract identical nodes from the pbc pair lists
void setPBCPairs(std::vector<std::pair<UInt, UInt>> &pairs);
//! attach a vector to bridging zone (sync with atomic migrations)
void attachVector(ContainerArray<Real> &tab);
// void buildContinuumConstraint(ContainerArray<Real> &A,
// ContainerArray<Real> &node_shape,
// ContainerArray<Real> &node_weight);
void applyContinuumConstraint(ArrayView A, ContainerArray<Real> &rhs,
ContainerArray<Real> &node_weight);
protected:
//! function to call to synch migrated data along with atoms
virtual void updateForMigration();
//! sends the buffer array of atomic DOFs: GROUP_FROM -> GROUP_DEST
void communicateBufferAtom2Continuum(ContainerArray<Real> &buf);
//! internal function that synch the buffer array of atomic DOFs by sum
void synchSumBuffer(ContainerArray<Real> &buf);
void synchSumBuffer() { synchSumBuffer(this->buffer); };
//! set atomic sites from an interpolated array
void setAtomicDOFs(FieldType field);
private:
//! attach a vector to the bridging zone (coherency will thus be maintained
//! through atomic migrations)
void attachVector(ContainerArray<Real> &tab, const std::string &name);
//! sends the internal buffer array of atomic DOFs GROUP_FROM -> GROUP_DEST
void communicateBufferAtom2Continuum();
//! sends the buffer array of atomic DOFs: GROUP_DEST -> GROUP_FROM
void communicateBufferContinuum2Atom(ContainerArray<Real> &buf);
//! sends the internal buffer array of atomic DOFs: GROUP_DEST->GROUP_FROM
void communicateBufferContinuum2Atom();
void declareParams();
//! 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();
//! 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
template <typename Matrix> void cumulPBC(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);
//! create an array with interpolated field on atomic sites
void interpolatePointData(ContainerArray<Real> &data_atom,
ContainerArray<Real> &data_node);
//! project atomic values on mesh interpolated solution
void projectPointDataOnMesh(ContainerArray<Real> &point_data,
ContainerArray<Real> &continuum_field,
const std::string &message);
//! project atomic values on mesh interpolated solution
void projectPointDataOnMesh(FieldType field, ContainerArray<Real> &buffer);
//! filter an atomic array associated with the detected atoms in the bridging
//! zone
void filterArray(ContainerArray<Real> &array);
//****************************************************************
// templated functions
//****************************************************************
public:
DECORATE_FUNCTION_DISPATCH(init, MD, CONTINUUM)
//! Init this object : select DOFs, associate them and compute shapematrix
template <typename ContA, typename ContC>
void init(ContA &contA, ContC &contC);
// DECORATE_FUNCTION_DISPATCH(buildNodeShape, CONTINUUM)
// //! build node_shape vector \sum_i \varphi_I(X_i)
// template <typename ContC> void buildNodeShape(ContC &meshList);
DECORATE_FUNCTION_DISPATCH(solveLeastSquare, ContainerArray<Real>,
ContainerArray<Real>, CONTINUUM)
//! leastsquare optimization returning a nodal array
template <typename ContC>
void solveLeastSquare(ContainerArray<Real> &mesh_data,
ContainerArray<Real> &atomic_data, ContC &meshList);
// DECORATE_FUNCTION_DISPATCH(averageOnElements, ContainerArray<Real>,
// ContainerArray<Real>, CONTINUUM)
// //! average point data per elements
// template <typename ContC>
// void averageOnElements(ContainerArray<Real> &data_point,
// ContainerArray<Real> &data_mesh, ContC &meshList);
DECORATE_FUNCTION_DISPATCH(buildLocalPBCPairs, CONTINUUM)
//! extract identical nodes from the pbc pair lists
template <typename ContC> void buildLocalPBCPairs(ContC &meshList);
DECORATE_FUNCTION_DISPATCH(buildPointList, MD)
//! internal function that filter the interesting MD DOFs and compute weights
template <typename ContA> void buildPointList(ContA &contA);
DECORATE_FUNCTION_DISPATCH(buildShapeMatrix, UInt, MD, CONTINUUM)
//! compute the association vector and smatrix
template <typename ContA, typename ContB>
void buildShapeMatrix(UInt nb_points, ContA &contA, ContB &unmatchedMeshList);
DECORATE_FUNCTION_DISPATCH(filterPointListForUnmatched, MD, MD)
//! filter an atomic container using unmatched points
template <typename ContA1, typename ContA2>
void filterPointListForUnmatched(ContA1 &pointList,
ContA2 &unmatchedPointList);
protected:
//! internal function that filter the interesting FE DOFs and compute weights
template <typename ContA, typename ContC>
void buildContinuumDOFsList(ContA &contA, ContC &contC);
DECORATE_FUNCTION_DISPATCH(filterContainerElems, std::vector<UInt>, CONTINUUM,
CONTINUUM)
//! filter a container (elems_rec or nodes_rec for instance) in order not to
//! take into account unmatched elements/nodes from BuildShapeMatrix
template <typename ContC1, typename ContC2>
void filterContainerElems(std::vector<UInt> &nb_atome_par_element,
ContC1 &unmatchedMeshList, ContC2 &meshList);
private:
//! convert node indexes to list of nodal references
template <typename ContainerMesh> void buildNodeList(ContainerMesh &contMesh);
public:
//! contains the atoms filtered by geometry
FilterGeometry unmatchedPointList;
//! contains the atoms to be coupled
std::shared_ptr<FilterInterface> pointList;
//! contains the nodes&elements filtered by geometry
FilterGeometry unmatchedMeshList;
//! contains the nodes&elements to be coupled
std::shared_ptr<FilterInterface> meshList;
//! node shape vector
// ComputeCompatibility node_shape;
public:
//! shape matrix (containing interpolation values of the initial atomic sites)
ShapeMatrix 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;
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
private:
//! shape matrix (containing interpolation values of the initial atomic sites)
// ShapeMatrix<ContainerPoints::Dim> *smatrix;
protected:
//! Container of points
// ContainerPoints &contPoints;
// //! Container of nodes
// ContainerMesh &contMesh;
//! flag if in group continuum
bool is_in_continuum;
//! flag if in group atomic
bool is_in_atomic;
};
__END_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
#include "bridging_inline_impl.hh"
/* -------------------------------------------------------------------------- */
#endif /* __LIBMULTISCALE_BRIDGING_HH__ */

Event Timeline