Page MenuHomec4science

compute_mesh.cc
No OneTemporary

File Metadata

Created
Tue, Sep 10, 11:00

compute_mesh.cc

/**
* @file compute_mesh.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief This computes generate an independent mesh from points and connectivities provided as computes
*
* @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/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "lm_common.hh"
#include "compute_point_set.hh"
#include "compute.hh"
#include "lib_stimulation.hh"
#include "lib_dumper.hh"
#include "lib_filter.hh"
#include "lib_md.hh"
#include "lib_continuum.hh"
#include "lib_dd.hh"
#include "action_manager.hh"
#include "filter_manager.hh"
#include "factory_multiscale_inline_impl.hh"
#include "communicator.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <typename Cont>
void ComputeMesh<Cont>::build(Cont & cont){
// copy the nodes
ContainerNodes & nds = this->getContainerNodes();
nds.clear();
RefPointData tmp_nd;
for (UInt i = 0; i < cont.size(); ++i) {
tmp_nd = cont[i];
nds.add(tmp_nd);
}
// construct the connectivity
ComputeInterface * conn_ptr =
dynamic_cast<ComputeInterface*>(FilterManager::getManager().getObject(this->connectivity));
conn_ptr->build();
ContainerElems & els = this->getContainerElems();
els.clear();
RefGenericElem tmp_el;
Real * _ptr = &((*conn_ptr)[0]);
for (UInt i = 0;
i < conn_ptr->size()/this->nb_nodes_per_elem;
++i,_ptr+=this->nb_nodes_per_elem) {
tmp_el.setConnectivity(_ptr,this->nb_nodes_per_elem);
els.add(tmp_el);
}
}
/* -------------------------------------------------------------------------- */
template <typename Cont>
void ComputeMesh<Cont>::connect(ActionManager & f){
f.template create<ComputeMesh<Cont> >(*this);
};
/* -------------------------------------------------------------------------- */
template <typename Cont>
void ComputeMesh<Cont>::connect(FilterManager & f){
f.template create<ComputeMesh<Cont> >(*this);
};
/* -------------------------------------------------------------------------- */
template <typename Cont>
void ComputeMesh<Cont>::visit(ComponentLMOut<Cont> & obj){
this->copyContainerInfo(obj.getOutput());
if (obj.getOutput().getRelease() != UINT_MAX &&
obj.getOutput().getRelease() <= this->getRelease()) return;
this->copyReleaseInfo(obj);
Communicator & comm = Communicator::getCommunicator();
CommGroup group = obj.getOutput().getCommGroup();
if (comm.amIinGroup(group))
this->build(obj);
}
/* -------------------------------------------------------------------------- */
template <typename _Input>
void ComputeMesh<_Input>::build(){
if (!this->input) {
DUMP("this filter has no input",DBG_WARNING);
}
else this->input->accept(*this);
}
/* -------------------------------------------------------------------------- */
/* LMDESC MESH
This computes generate an independent mesh from a compute
which contains positions and a compute which contains connectivities.
*/
/* LMEXAMPLE COMPUTE pset MESH INPUT coords */
template <typename _Input>
inline void ComputeMesh<_Input>::declareParams(){
/* LMKEYWORD CONN
Specify the filter ID where the connectivity is stored
*/
this->parseKeyword("CONN",connectivity);
/* LMKEYWORD NB_NODES_PER_ELEM
Specify the number of nodes per elem
*/
this->parseKeyword("NB_NODES_PER_ELEM",nb_nodes_per_elem);
};
DECLARE_COMPUTE_REFPOINT(ComputeMesh);
DECLARE_COMPUTE_REF(ComputeMesh,LIST_ATOM_MODEL);
DECLARE_COMPUTE_REF(ComputeMesh,LIST_CONTINUUM_MODEL);
DECLARE_COMPUTE_REF(ComputeMesh,LIST_DD_MODEL);
__END_LIBMULTISCALE__

Event Timeline