Page MenuHomec4science

field.hh
No OneTemporary

File Metadata

Created
Wed, Dec 4, 05:58

field.hh

/**
* @file field.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
*
* @date creation: Thu Mar 11 2010
* @date last modification: Tue Feb 05 2013
*
* @brief description of field
*
* @section LICENSE
*
* Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* IOHelper 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.
*
* IOHelper 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 IOHelper. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __IOHELPER_FIELD_HH__
#define __IOHELPER_FIELD_HH__
/* -------------------------------------------------------------------------- */
#include "field_interface.hh"
// #include "paraview_helper.hh"
// #include "dumper_lammps.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_IOHELPER__
template <class Cont>
class Field : public FieldInterface {
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
public:
typedef typename Cont::iterator iterator;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
Field(Cont & c, const std::string name):my_field(c), name(name){};
virtual ~Field(){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
//! return true if the data is a constant size per element
inline bool isHomogeneous();
//! return the size per element (valid only if isHomogeneous is true)
inline UInt getDim();
//! return the number of stored items (elements, nodes, etc...)
inline UInt size();
//! return the description name of the container
inline std::string getName();
//! accept to be visited by a visitor
void accept(Visitor & v);
//! begin method
iterator begin(){return my_field.begin();}
//! end method
iterator end(){return my_field.end();}
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
inline DataType getDataType() { return my_field.getDataType(); }
public:
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
private:
Cont & my_field;
std::string name;
};
/* -------------------------------------------------------------------------- */
template <class Cont>
bool Field<Cont>::isHomogeneous(){
return my_field.isHomogeneous();
}
/* -------------------------------------------------------------------------- */
template <class Cont>
UInt Field<Cont>::getDim(){
return my_field.getDim();
}
/* -------------------------------------------------------------------------- */
template <class Cont>
std::string Field<Cont>::getName(){
return name;
}
/* -------------------------------------------------------------------------- */
template <class Cont>
UInt Field<Cont>::size(){
return my_field.size();
}
/* -------------------------------------------------------------------------- */
__END_IOHELPER__
#endif /* __IOHELPER_FIELD_HH__ */

Event Timeline