Page MenuHomec4science

container_dd.hh
No OneTemporary

File Metadata

Created
Sun, Nov 17, 04:50

container_dd.hh

/**
* @file container_dd.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Thu Jul 24 14:21:58 2014
*
* @brief Generic container for DD 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_CONTAINER_DD_HH__
#define __LIBMULTISCALE_CONTAINER_DD_HH__
/* -------------------------------------------------------------------------- */
#include "container.hh"
#include "container_array.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <typename ContNodes>
class ContainerDD : public Container_base<typename ContNodes::Ref> {
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
public:
using ContainerNodes = ContNodes;
using iterator = typename ContNodes::iterator;
using Ref = typename ContNodes::Ref;
using ContainerSubset = ContainerDD<ContainerArray<Ref>>;
static constexpr UInt Dim = Ref::Dim;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
iterator begin(DOFType dt = dt_local) { return container_nodes.begin(dt); };
iterator end(DOFType dt = dt_local) { return container_nodes.end(dt); };
ContainerDD(const LMID &id);
virtual ~ContainerDD();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
// void incRelease() {
// LM_TOIMPLEMENT;
// // Container_base<typename ContNodes::Ref>::incRelease();
// // container_nodes->incRelease();
// // container_sources->incRelease();
// // container_obstacles->incRelease();
// };
// void setRelease(UInt rel) {
// Container_base<typename ContNodes::Ref>::setRelease(rel);
// container_nodes.setRelease(rel);
// };
// operator ContainerNodes &() {
// LM_FATAL(
// "silent conversion from ContainerDD to ContainerNode is not allowed");
// return container_nodes;
// }
void clear() { container_nodes.clear(); }
std::vector<Ref> &getArray() { return getContainerNodes().getArray(); }
UInt size(DOFType dt = dt_local) { return getContainerNodes().size(); }
Ref &get(UInt index) { return getContainerNodes().get(index); }
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
public:
ContNodes &getContainerNodes() { return container_nodes; };
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
private:
ContNodes container_nodes;
};
/* -------------------------------------------------------------------------- */
template <typename ContNodes>
ContainerDD<ContNodes>::ContainerDD(const LMID &id)
: container_nodes(id + ":nodes") {}
/* --------------------------------------------------------------------------
*/
template <typename ContNodes> ContainerDD<ContNodes>::~ContainerDD() {}
/* --------------------------------------------------------------------------
*/
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_CONTAINER_DD_HH__ */

Event Timeline