Page MenuHomec4science

point_association.hh
No OneTemporary

File Metadata

Created
Fri, Jul 5, 05:04

point_association.hh

/**
* @file point_association.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
*
* @date Sun Feb 02 17:45:17 2014
*
* @brief Coupling tool to associate point-like DOFs
*
* @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_POINT_ASSOCIATION_HH__
#define __LIBMULTISCALE_POINT_ASSOCIATION_HH__
#define TIMER
#include "compute_periodic_position.hh"
#include "compute_python.hh"
#include "compute_true_displacement.hh"
#include "container_array.hh"
#include "dof_association.hh"
#include "filter_point.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
class PointAssociation : public DofAssociation {
public:
PointAssociation(const std::string &name);
virtual ~PointAssociation();
//! function to call to synch migrated data along with atoms
virtual void updateForMigration() { LM_TOIMPLEMENT; };
//! method to clear every data or object allocated (for a reuse)
virtual void clearAll();
//! Init this object: select points for each domain and find associations
template <typename ContA, typename ContB>
void init(ContA &contA, ContB &contB);
//! copy field values from model A to B
template <FieldType field> inline void enforceField();
//! mix a field between the two models
template <FieldType field, typename ContA, typename ContB>
inline void mixField(ContA &pointsAlist, ContB &pointsBlist);
//! set a field to zero (used for usually used to squash the pad atom forces
template <FieldType field> inline void zeroFields();
//! function to be called to update the duo vector and parallel structures
template <typename ContA, typename ContB>
void updateForMigration(ContA &contA, ContB &conB);
private:
/** Filters the degrees of freedom geometrically and then by the list of
applicable points*/
template <typename container, typename PointList>
void buildPointList(container &cont, PointList &pointList);
//! function that fills the grid for association
void fillGrid();
//! function that perfoms the association
void associate();
protected:
//! Prepare buffer for synchronisation
template <FieldType ftype, typename ContA>
inline void prepareSynchronisation(ContA &contA);
template <typename ContA>
inline void prepareSynchronisationDisplacement(ContA &contA);
//! synchronise buffers
template <FieldType ftype> inline void synchronise();
//! apply the buffer
template <FieldType field, typename ContA, typename ContB>
inline void applyBuffer(ContA &contA, ContB &contB);
template <bool pbc_x, bool pbc_y, bool pbc_z, typename ContA, typename ContB>
inline void applyBufferPosition(ContA &pointsAlist, ContB &pointsBlist);
void declareParams();
//! after receiving the association vectors, build the final set of points
void filterPointListAForUnmatched();
void filterPointListBForUnmatched();
//! internal function to check that the communication scheme works fine
void checkPositionCoherency();
//! compute the weight for the arlequin style
template <typename ContA, typename ContB>
void computeWeights(ContA &contA, ContB &contB);
//! generic containers that contain the point references to be coupled
FilterPoint pointsAlist;
FilterPoint pointsBlist;
//! contains the point references selected with filterpoint
FilterPoint unmatchedA;
FilterPoint unmatchedB;
//! container for field variables to sync
ContainerArray<Real> field_buffer;
//! association vector
ContainerArray<UInt> point2Point;
//! number of associations found by associate
UInt assoc_found;
//! tolerance to be used when comparing atomic positions
Real tolerance;
//! file path to the filteratom file
std::string path;
//! file path to the python script to generate the weights
std::string weight_path;
//! the weights: generated by python
ComputePython weights;
//! the weights of model A
ContainerArray<Real> weightsA;
//! the weights of model B
ContainerArray<Real> weightsB;
//! necessary to deal with periodic boundary conditions in the pad
bool pbc[3];
//! flag that decide if checkcoherency should be called
bool check_coherency;
ComputeTrueDisplacement true_disp;
//! grid used to search point <-> association
OutputContainer &grid;
};
__END_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
#include "point_association_inline_impl.hh"
/* -------------------------------------------------------------------------- */
#endif /* __LIBMULTISCALE_POINT_ASSOCIATION_HH__ */

Event Timeline