Page MenuHomec4science

dof_association_interface.hh
No OneTemporary

File Metadata

Created
Tue, Nov 12, 12:47

dof_association_interface.hh

/**
* @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_INTERFACE_HH__
#define __LIBMULTISCALE_DOF_ASSOCIATION_INTERFACE_HH__
/* -------------------------------------------------------------------------- */
#include "compute_extract.hh"
#include "duo_distributed_vector.hh"
#include "lm_parsable.hh"
#include "spatial_grid_libmultiscale.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
class DofAssociationInterface : public Parsable, public Component {
public:
DofAssociationInterface(const std::string &name);
virtual ~DofAssociationInterface();
//! 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;
//! return the local number of matched points (parallel safe)
virtual UInt getNumberLocalMatchedPoints() = 0;
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:
void declareParams();
//! exchange geometries: for coarse desc of communication scheme
template <typename ContA, typename ContB>
void exchangeGeometries(ContA &subA, ContB &subB);
//! exchange geometries: for coarse desc of communication scheme
void exchangeGeometries(Cube &cube);
//! exchange points positions following coarse description
void exchangePositions(UInt Dim);
//! 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:
// to parametrize the grid to speed search (decomposition in each direction)
Vector<3, UInt> grid_division;
//! 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 points associated
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 check for coherency
bool check_coherency;
private:
//! duodistributed vector used to synchronize vectors/matrices
std::unique_ptr<DuoDistributedVector> duo_vector;
};
/* -------------------------------------------------------------------------- */
template <typename ContA, typename ContB>
void DofAssociationInterface::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);
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_DOF_ASSOCIATION_INTERFACE_HH__ */

Event Timeline