Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64181372
dof_association.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
Sat, May 25, 03:23
Size
7 KB
Mime Type
text/x-c++
Expires
Mon, May 27, 03:23 (2 d)
Engine
blob
Format
Raw Data
Handle
17864511
Attached To
rLIBMULTISCALE LibMultiScale
dof_association.hh
View Options
/**
* @file dof_association.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Tue Jan 21 12:37:46 2014
*
* @brief Mother of all object which associates DOFs for coupling purpose
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it
* under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but
* WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_DOF_ASSOCIATION_HH__
#define __LIBMULTISCALE_DOF_ASSOCIATION_HH__
/* -------------------------------------------------------------------------- */
#include "compute_extract.hh"
#include "duo_distributed_vector.hh"
#include "lm_parsable.hh"
#include "spatial_grid_libmultiscale.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template
<
typename
ContainerA
,
typename
ContainerB
,
UInt
Dim
>
class
DofAssociation
:
public
Parsable
{
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public
:
DofAssociation
(
const
std
::
string
&
name
,
ContainerA
&
cA
,
ContainerB
&
cB
);
virtual
~
DofAssociation
();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public
:
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
public
:
//! set the name of the bridging zone (usefull for dumped files)
void
setID
(
const
std
::
string
&
name
)
{
ID
=
name
;
};
//! return the name of the bridging zone (usefull for dumped files)
const
std
::
string
&
getID
()
{
return
ID
;
};
//! method to clear every data or object allocated (for a reuse)
virtual
void
clearAll
()
=
0
;
//! Init this object : select DOFs, associate them and compute shapematrix
virtual
void
init
()
=
0
;
//! delete grid structure to sort elements
void
deleteGrid
();
//! return the local number of points (parallel safe)
UInt
getLocalPoints
();
protected
:
void
declareParams
();
/* ------------------------------------------------------------------------ */
/* Parallel Methods */
/* ------------------------------------------------------------------------ */
public
:
//! function used to redistribute a vector from A to B
void
distributeVectorA2B
(
const
std
::
string
&
name_vec
,
ContainerArray
<
Real
>
&
vec
);
//! function used to redistribute a vector from B to A
void
distributeVectorB2A
(
const
std
::
string
&
name_vec
,
ContainerArray
<
Real
>
&
vec
);
//! function used to synchronize vectors (by summing them)
void
synchronizeVectorBySum
(
const
std
::
string
&
name_vec
,
ContainerArray
<
Real
>
&
vec
);
//! function used update the duo vector for migrations
void
synchronizeMigration
(
CommGroup
&
group1
,
CommGroup
&
group2
);
protected
:
//! exchange geometries: for coarse desc of communication scheme
template
<
typename
ContA
,
typename
ContB
>
void
exchangeGeometries
(
ContA
&
subA
,
ContB
&
subB
);
void
exchangeGeometries
(
Cube
&
cube
);
//! exchange points positions following coarse description
void
exchangePositions
();
//! exchange association information for full communication scheme description
void
exchangeAssociationInformation
(
ContainerArray
<
UInt
>
&
managed
);
//! exchange duplicate points info from A processors to B ones
void
exchangeRejectedContinuumOwners
(
std
::
vector
<
std
::
vector
<
UInt
>>
&
unassociated_points
);
void
createDuoVectorA
(
const
std
::
string
&
name
,
ContainerArray
<
UInt
>
&
managed
,
std
::
vector
<
std
::
vector
<
UInt
>>
&
unassociated_points
);
//! create duo vector
void
createDuoVectorB
(
const
std
::
string
&
name
);
//! get duo vector
DuoDistributedVector
&
getDuoVector
();
//! extract a position vector from a subset container
template
<
typename
ContA
>
void
buildPositions
(
ContA
&
sub
);
//! filter associations so that removed DOF are acknowledged
void
filterAssoc
();
private
:
void
exchangeNbPointsPerProc
();
public
:
//! association vector
ContainerArray
<
UInt
>
pointToElement
;
protected
:
//! the spatial grid used to speedup the association build
SpatialGridLibMultiScale
<
UInt
,
Dim
>
*
grid
;
//! ID given to the zone
std
::
string
ID
;
// to parametrize the grid to speed search (decomposition in each direction)
Vector
<
Dim
,
UInt
>
grid_division
;
//! Container of whatever
ContainerA
&
contA
;
//! Container of whatever
ContainerB
&
contB
;
//! the intersection geometry ID
LMID
geomID
;
//! parallel id of group A
CommGroup
&
comm_group_A
;
//! parallel id of group B
CommGroup
&
comm_group_B
;
//! array that specifies what processor I should communicate with
std
::
vector
<
UInt
>
com_with
;
//! total number of points in the associated zone
UInt
total_points
;
//! array that specifies the number of points per proc
std
::
vector
<
UInt
>
nb_points_per_proc
;
//! generated positions (by BuildPosition method)
ContainerArray
<
Real
>
positions
;
//! local atoms in the bridged zone
UInt
local_points
;
//! number of processors in zone A
UInt
nb_zone_A
;
//! number of processors in zone B
UInt
nb_zone_B
;
//! am i in group A
bool
in_group_A
;
//! am i in group B
bool
in_group_B
;
//! flag to know wether we have to chack for coherency
bool
check_coherency
;
private
:
//! duodistributed vector used to synchronize vectors/matrices
DuoDistributedVector
*
duo_vector
;
};
/* -------------------------------------------------------------------------- */
template
<
typename
ContainerA
,
typename
ContainerB
,
UInt
Dim
>
template
<
typename
ContA
,
typename
ContB
>
void
DofAssociation
<
ContainerA
,
ContainerB
,
Dim
>::
exchangeGeometries
(
ContA
&
subA
,
ContB
&
subB
)
{
if
(
comm_group_A
==
comm_group_B
)
return
;
Cube
localGeom
;
if
(
in_group_A
)
localGeom
=
subA
->
getBoundingBox
();
if
(
in_group_B
)
localGeom
=
subB
->
getBoundingBox
();
exchangeGeometries
(
localGeom
);
}
/* -------------------------------------------------------------------------- */
template
<
typename
ContainerA
,
typename
ContainerB
,
UInt
Dim
>
template
<
typename
ContA
>
void
DofAssociation
<
ContainerA
,
ContainerB
,
Dim
>::
buildPositions
(
ContA
&
sub
)
{
ComputeExtract
c_positions
(
"ComputeExtract:"
+
this
->
getID
());
c_positions
.
setParam
(
"FIELD"
,
_position0
);
c_positions
.
buildManual
(
*
sub
);
this
->
positions
=
c_positions
.
getArray
();
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif
/* __LIBMULTISCALE_DOF_ASSOCIATION_HH__ */
Event Timeline
Log In to Comment