Page MenuHomec4science

filter_geometry_points.cc
No OneTemporary

File Metadata

Created
Tue, Sep 10, 14:16

filter_geometry_points.cc

/**
* @file filter_geometry_points.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
*
* @date Thu Jul 24 14:25:10 2014
*
* @brief This filter allows to select DOFs based on geometrical criteria
*
* @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.
*
*/
/* -------------------------------------------------------------------------- */
#include "lm_common.hh"
#include "lib_md.hh"
#include "lib_dd.hh"
#include "lib_continuum.hh"
#include "geometry.hh"
#include "geometry_manager.hh"
#include "reference_manager.hh"
#include "filter_manager.hh"
#include "filter_geometry.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <typename Cont>
void FilterGeometry<Cont>::build(Cont & cont){
static const UInt Dim = Cont::Dim;
if (this->nbElem() && !current_position_flag) return;
if(!do_not_reset_boundingbox_flag) {
this->getBoundingBox().resetDimensions();
}
this->empty();
Geometry * g = GeometryManager::getManager().getGeometry(geom);
typename Cont::iterator it = cont.getIterator(this->dt);
typename Cont::Ref at;
std::vector<ComputeInterface*> computes_ptr;
computes_ptr.resize(compute_list.size());
for (UInt comp = 0; comp < compute_list.size(); ++comp) {
this->out_computes[comp]->empty();
FilterID id = compute_list[comp];
ComputeInterface * my_compute
= dynamic_cast<ComputeInterface*>(FilterManager::getManager().getObject(id));
if (!my_compute)
LM_FATAL("invalid compute passed to dumper text " << compute_list[0]);
computes_ptr[comp] = my_compute;
my_compute->build();
this->out_computes[comp]->copyReleaseInfo(cont);
this->out_computes[comp]->copyContainerInfo(cont);
}
int counter = 0;
for(at = it.getFirst() ; !it.end() ; at = it.getNext()) {
Real positions[3] = {0.,0.,0.};
if(current_position_flag){
at.getPositions(positions);}
else{
at.getPositions0(positions);}
DUMP("Testing point at position " << at.position(0),DBG_ALL);
if (g->contains<Dim>(positions)) {
if(!do_not_reset_boundingbox_flag)
this->getBoundingBox().extendBoundingBox(positions);
DUMP("Accepting atom " << at,DBG_ALL);
this->add(at);
for (UInt comp = 0; comp < compute_list.size(); ++comp)
this->out_computes[comp]->add(computes_ptr[comp]->get(counter));
}
counter++;
}
#ifndef LM_OPTIMIZED
UInt nb = this->nbElem();
#endif // LM_OPTIMIZED
DUMP("The filter contains " << nb << " atoms in geometry " << *g,DBG_INFO);
if (!this->do_not_register) {
if (!current_position_flag) {
if (this->hasRefManager()) {
this->getRefManager().addSubSet(this->getID(),*this);}
}
}
if(sort_flag){
std::vector<typename Cont::Ref> &arr = this->getArray();
// do sort
std::sort(arr.begin(),arr.end(),ComparatorRef<typename Cont::Ref>());
}
}
/* -------------------------------------------------------------------------- */
DECLARE_FILTER(FilterGeometry,LIST_ATOM_MODEL);
DECLARE_FILTER(FilterGeometry,LIST_DD_MODEL);
DECLARE_FILTER_REFPOINT(FilterGeometry);
DECLARE_FILTER_GENERIC_MESH(FilterGeometry);
__END_LIBMULTISCALE__

Event Timeline