Page MenuHomec4science

container_paradis.hh
No OneTemporary

File Metadata

Created
Mon, Aug 5, 00:18

container_paradis.hh

/**
* @file container_paradis.hh
*
* @author Till Junge <till.junge@epfl.ch>
*
* @date Mon Jul 28 09:52:51 2014
*
* @brief ParaDiS container of 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_PARADIS_HH__
#define __LIBMULTISCALE_CONTAINER_PARADIS_HH__
/* -------------------------------------------------------------------------- */
#include "container.hh"
#include "ref_node_paradis.hh"
/* -------------------------------------------------------------------------- */
#define PARALLEL
extern "C" {
#include "Home.h"
#include "Typedefs.h"
#undef X
#undef Y
}
#undef PARALLEL
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
class ReferenceManagerParaDis {
public:
template <typename Obj>
void attachObject(Obj &obj, ContainerArray<RefParaDiSNode>) {
LM_TOIMPLEMENT;
}
};
/* -------------------------------------------------------------------------- */
/**
* Class ContainerParadis
*
*/
class ContainerParaDiSNode : public virtual LMObject,
public Container_base<RefParaDiSNode> {
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
using typename Container_base<RefParaDiSNode>::iterator_base;
public:
class iterator;
static constexpr UInt Dim = 3;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
ContainerParaDiSNode(const LMID &id)
: LMObject(id), Container_base<RefParaDiSNode>() {
paradis_ptr = NULL;
};
~ContainerParaDiSNode(){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
virtual ReferenceManagerParaDis &getRefManager() {
LM_TOIMPLEMENT;
return refmanager;
};
void setGrain(Home_t *home) {
paradis_ptr = home;
node.setHome(home); // CHANGE THIS
// node.setStressVector(paradis_ptr->getDisloNodes()->getStress());//CHANGE
// THIS//PROBLEM, see ref_node_paradis.h!!!!!!
};
iterator begin(DOFType dt = dt_local);
iterator end(DOFType dt = dt_local);
RefParaDiSNode &get(UInt index);
UInt size(DOFType dt = dt_local);
void init(){};
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
RefParaDiSNode node;
// DisloNodes nodes;
private:
Home_t *paradis_ptr;
//! reference manager for ParaDis
ReferenceManagerParaDis refmanager;
};
__END_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
#include "iterator_paradis.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
inline UInt ContainerParaDiSNode::size(DOFType dt) {
if (this->paradis_ptr == NULL)
return 0;
unsigned int nb_elem(0);
for (int i = 0; i < this->paradis_ptr->newNodeKeyPtr; ++i) {
if (this->paradis_ptr->nodeKeys[i] != (Node_t *)NULL)
++nb_elem;
}
return nb_elem;
};
/* -------------------------------------------------------------------------- */
inline ContainerParaDiSNode::iterator ContainerParaDiSNode::begin(DOFType dt) {
ContainerParaDiSNode::iterator it(*this);
return it;
}
/* -------------------------------------------------------------------------- */
inline ContainerParaDiSNode::iterator ContainerParaDiSNode::end(DOFType dt) {
ContainerParaDiSNode::iterator it(*this, node.paradis_ptr->newNodeKeyPtr);
return it;
}
/* -------------------------------------------------------------------------- */
inline RefParaDiSNode &ContainerParaDiSNode::get(unsigned int index) {
node.setIndex(index);
return node;
}
/* -------------------------------------------------------------------------- */
///
/// Doing elements now
///
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_CONTAINER_PARADIS_HH__ */

Event Timeline