Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F67676467
bridging.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jun 23, 18:07
Size
10 KB
Mime Type
text/x-c++
Expires
Tue, Jun 25, 18:07 (2 d)
Engine
blob
Format
Raw Data
Handle
18449766
Attached To
rLIBMULTISCALE LibMultiScale
bridging.hh
View Options
/**
* @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_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 */
class
Bridging
:
public
DofAssociation
{
public
:
// using ContainerPointsSubset = typename ContainerPoints::ContainerSubset;
// using ContainerMeshSubset = typename ContainerMesh::ContainerSubset;
Bridging
(
const
std
::
string
&
name
);
virtual
~
Bridging
();
//! extract identical nodes from the pbc pair lists
void
setPBCPairs
(
std
::
vector
<
std
::
pair
<
UInt
,
UInt
>>
&
pairs
)
{
pbc_pairs
=
pairs
;
};
// auto &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
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
);
//! 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
(
Eigen
::
MatrixXf
&
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
);
void
buildContinuumConstraint
(
ContainerArray
<
Real
>
&
A
,
ContainerArray
<
Real
>
&
node_shape
,
ContainerArray
<
Real
>
&
node_weight
);
void
applyContinuumConstraint
(
ArrayView
A
,
ContainerArray
<
Real
>
&
rhs
,
ContainerArray
<
Real
>
&
node_weight
);
DECORATE_FUNCTION_DISPATCH
(
solveLeastSquare
,
MD
)
//! leastsquare optimization returning a nodal array
template
<
typename
ContC
>
void
solveLeastSquare
(
ContainerArray
<
Real
>
&
mesh_data
,
ContainerArray
<
Real
>
&
atomic_data
,
ContC
&
meshList
);
//! create an array with interpolated field on atomic sites
void
interpolatePointData
(
ContainerArray
<
Real
>
&
data_atom
,
ContainerArray
<
Real
>
&
data_node
);
DECORATE_FUNCTION_DISPATCH
(
averageOnElements
,
MD
)
//! average point data per elements
template
<
typename
ContC
>
void
averageOnElements
(
ContainerArray
<
Real
>
&
data_point
,
ContainerArray
<
Real
>
&
data_mesh
,
ContC
&
meshList
);
//! attach a vector to the bridging zone (coherency will thus be maintained
//! through atomic migrations)
void
attachVector
(
ContainerArray
<
Real
>
&
tab
,
const
std
::
string
&
name
);
DECORATE_FUNCTION_DISPATCH
(
buildLocalPBCPairs
,
MD
)
//! extract identical nodes from the pbc pair lists
template
<
typename
ContC
>
void
buildLocalPBCPairs
(
ContC
&
meshList
);
//! internal function that filter the interesting MD DOFs and compute weights
template
<
typename
ContA
>
void
buildPointList
(
ContA
&
contA
);
//! 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
)
//! filter an atomic container using unmatched points
template
<
typename
ContA
>
void
filterPointListForUnmatched
(
ContA
&
pointList
,
ContA
&
unmatchedPointList
);
//! build the full leastsquare matrix (works in sequential only)
void
buildLeastSquareMatrix
(
Eigen
::
MatrixXf
&
mat
);
//! extract the complete shape matrix
void
extractShapeMatrix
(
Eigen
::
MatrixXf
&
mat
);
//! set atomic sites from an interpolated array
void
setAtomicDOFs
(
FieldType
field
);
protected
:
//! internal function that filter the interesting FE DOFs and compute weights
template
<
typename
ContA
,
typename
ContC
>
void
buildContinuumDOFsList
(
ContA
&
contA
,
ContC
&
contC
);
//! filter a container (elems_rec or nodes_rec for instance) in order not to
DECORATE_FUNCTION_DISPATCH
(
filterContainerElems
,
MD
)
//! take into account unmatched elements/nodes from BuildShapeMatrix
template
<
typename
ContC
>
void
filterContainerElems
(
std
::
vector
<
UInt
>
&
nb_atome_par_element
,
ContC
&
unmatchedMeshList
,
ContC
&
meshList
);
//! 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
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
;
private
:
//! shape matrix (containing interpolation values of the initial atomic sites)
std
::
shared_ptr
<
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
:
UInt
getNumberPoints
();
UInt
getNumberElems
();
UInt
getNumberNodes
();
//! 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
);
//! attach a vector to bridging zone (sync with atomic migrations)
void
attachVector
(
ContainerArray
<
Real
>
&
tab
);
//! 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__
#endif
/* __LIBMULTISCALE_BRIDGING_HH__ */
Event Timeline
Log In to Comment