Page MenuHomec4science

support_tmpl.hh
No OneTemporary

File Metadata

Created
Fri, Oct 4, 16:46

support_tmpl.hh

/**
* @file support_tmpl.hh
*
* @author Nicolas Richart
*
* @date creation Fri Oct 06 2017
*
* @brief A Documented file.
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* Akantu 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.
*
* Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "dumper_field.hh"
#include "element_group.hh"
#include "node_group.hh"
#include "support.hh"
/* -------------------------------------------------------------------------- */
#ifndef __AKANTU_SUPPORT_TMPL_HH__
#define __AKANTU_SUPPORT_TMPL_HH__
namespace akantu {
namespace dumper {
/* ------------------------------------------------------------------------ */
template <> class Support<Mesh> : public SupportBase, public SupportElements {
public:
using ElementTypesIteratorHelper =
ElementTypeMapArray<UInt, ElementType>::ElementTypesIteratorHelper;
explicit Support(const Mesh & inner)
: SupportBase(SupportType::_mesh), inner(inner),
nodes(make_field(inner.getNodes(), *this)),
connectivities(make_field(inner.getConnectivities(), *this)) {
nodes->addProperty("name", "position");
connectivities->addProperty("name", "connectivities");
this->addProperty("name", inner.getID());
this->addProperty("release", this->getRelease());
}
FieldArray<Real> & getNodes() const { return *nodes; }
FieldElementMapArray<UInt> & getConnectivities() const {
return *connectivities;
};
ElementTypesIteratorHelper elementTypes() const override {
return inner.elementTypes(inner.getSpatialDimension(), _not_ghost,
_ek_not_defined);
}
Int getRelease() { return inner.getRelease(); }
protected:
const Mesh & inner;
std::unique_ptr<FieldArray<Real>> nodes;
std::unique_ptr<FieldElementMapArray<UInt>> connectivities;
};
/* ------------------------------------------------------------------------ */
template <>
class Support<ElementGroup> : public SupportBase, public SupportElements {
public:
explicit Support(const ElementGroup & inner)
: SupportBase(SupportType::_element_group), inner(inner),
nodes(make_field(inner.getNodeGroup().getNodes(), *this)),
elements(make_field(inner.getElements(), *this)) {
nodes->addProperty("name", "nodes");
elements->addProperty("name", "elements");
this->addProperty("name", inner.getName());
this->addProperty("release", this->getRelease());
}
auto & getNodes() const { return *nodes; }
auto & getElements() const { return *elements; };
ElementTypesIteratorHelper elementTypes() const override {
return inner.elementTypes(inner.getMesh().getSpatialDimension(),
_not_ghost, _ek_not_defined);
}
Int getRelease() { return inner.getMesh().getRelease(); }
protected:
const ElementGroup & inner;
std::unique_ptr<FieldArray<UInt>> nodes;
std::unique_ptr<FieldElementMapArray<UInt>> elements;
};
} // namespace dumper
} // namespace akantu
#endif /* __AKANTU_SUPPORT_TMPL_HH__ */

Event Timeline