Page MenuHomec4science

lm_types.hh
No OneTemporary

File Metadata

Created
Fri, May 31, 21:25

lm_types.hh

/**
* @file lm_types.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Jaehyun Cho <jaehyun.cho@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
* @author Moseley Philip Arthur <philip.moseley@epfl.ch>
*
* @date Mon Sep 08 23:40:22 2014
*
* @brief This where the global types and enums of LibMultiScale are defined
*
* @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_LM_TYPES_HH__
#define __LIBMULTISCALE_LM_TYPES_HH__
/* -------------------------------------------------------------------------- */
#include <ostream>
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
// error management
/* -------------------------------------------------------------------------- */
#define LM_EXIT_FAILURE 1
#define LM_EXIT_SUCCESS 0
/* -------------------------------------------------------------------------- */
// TYPEDEFS
/* -------------------------------------------------------------------------- */
typedef unsigned int UInt;
typedef double Real;
typedef Real REAL;
/* -------------------------------------------------------------------------- */
// ENUMS
/* -------------------------------------------------------------------------- */
enum DOFType {
dt_local_master = 1,
dt_local_slave = 2,
dt_local = 3,
dt_ghost = 4,
dt_all = 255
};
/* -------------------------------------------------------------------------- */
enum GeomType {
BALL = 1,
CUBE = 2,
INTER = 3,
SUB = 4,
ELLIPSOID = 5,
UNION = 6,
CYLINDER = 7,
CHAUDRON = 8,
CUBE_SURFACE = 9
};
/* -------------------------------------------------------------------------- */
enum COutputType {
OUTPUT_REF = 1 ,
OUTPUT_REAL = 2 ,
OUTPUT_NULL = 32767
};
/* -------------------------------------------------------------------------- */
enum CouplingStage {
COUPLING_STEP1 = 1 ,
COUPLING_STEP2 = 2 ,
COUPLING_STEP3 = 4 ,
COUPLING_STEP4 = 8 ,
COUPLING_STEP5 = 16 ,
COUPLING_STEP6 = 32 ,
COUPLING_STEP7 = 64
};
/* -------------------------------------------------------------------------- */
enum Operator {
OP_NONE = 0,
OP_AVERAGE = 1 ,
OP_DENSITY = 2 ,
OP_DEVIATION = 4 ,
OP_MAX = 8 ,
OP_MIN = 16,
OP_SUM = 64
};
/* -------------------------------------------------------------------------- */
enum FieldType {
_position0 = 0,
_position = 1,
_displacement = 2,
_velocity = 3,
_force = 4,
_stress = 5,
_temperature = 6,
_grouprank = 7,
_strain = 8,
_epot = 9,
_applied_force = 10,
_mass = 11,
ft_uninitialised = 32767
};
/* -------------------------------------------------------------------------- */
enum ActionType {
at_stimulator = 0,
at_dumper = 1,
at_filter = 2,
at_compute = 4,
at_uninitialised = 32767
};
/* -------------------------------------------------------------------------- */
enum LatticeType {
_not_defined,
mono_atom_1d,
hex_2d,
hex_2d_radial,
fcc_3d
};
template <LatticeType type> struct LatticeDim {
static const UInt value;
};
template <> struct LatticeDim<mono_atom_1d> {static const UInt value = 1;};
template <> struct LatticeDim<hex_2d> {static const UInt value = 2;};
template <> struct LatticeDim<hex_2d_radial> {static const UInt value = 2;};
template <> struct LatticeDim<fcc_3d> {static const UInt value = 3;};
/* -------------------------------------------------------------------------- */
enum IntegrationSchemeStage {
NONE_STEP = 0 ,
PRE_DUMP = 1 ,
PRE_STEP1 = 2 ,
PRE_STEP2 = 4 ,
PRE_STEP3 = 8 ,
PRE_STEP4 = 16 ,
PRE_STEP5 = 32 ,
PRE_STEP6 = 64 ,
PRE_STEP7 = 128 ,
PRE_FATAL = 256 , //This stage only exists if a FATAL is triggered
ALL_STEP = 65536
};
/* -------------------------------------------------------------------------- */
class IntegrationSchemeMask {
public:
IntegrationSchemeMask(UInt mask){
stage = mask;
}
IntegrationSchemeMask(){
stage = NONE_STEP;
};
bool operator & (const IntegrationSchemeStage & s) const{
return (stage&s);
};
IntegrationSchemeMask & operator= (const IntegrationSchemeStage & s){
stage = s;
return (*this);
};
IntegrationSchemeMask operator|= (const IntegrationSchemeStage & s){
stage |= s;
return (*this);
};
IntegrationSchemeMask operator|= (const IntegrationSchemeMask & m){
stage |= m.stage;
return (*this);
};
bool isNone(){
return (stage == NONE_STEP);
}
virtual void printself(std::ostream & stream, int indent = 0) const{
stream << "NONE_STEP";
if ((*this) & PRE_DUMP) stream << "|PREDUMP";
if ((*this) & PRE_STEP1) stream << "|PRE_STEP1";
if ((*this) & PRE_STEP2) stream << "|PRE_STEP2";
if ((*this) & PRE_STEP3) stream << "|PRE_STEP3";
if ((*this) & PRE_STEP4) stream << "|PRE_STEP4";
if ((*this) & PRE_STEP5) stream << "|PRE_STEP5";
if ((*this) & PRE_STEP6) stream << "|PRE_STEP6";
if ((*this) & PRE_STEP7) stream << "|PRE_STEP7";
if ((*this) & PRE_FATAL) stream << "|PRE_FATAL";
if ((*this) & ALL_STEP) stream << "|ALL_STEP";
};
private:
UInt stage;
};
inline std::ostream & operator <<(std::ostream & stream, const IntegrationSchemeMask & _this)
{
_this.printself(stream);
return stream;
}
inline std::ostream & operator <<(std::ostream & stream, const IntegrationSchemeStage & _this)
{
switch(_this){
case NONE_STEP: stream << "NONESTEP"; break;
case PRE_DUMP : stream << "PREDUMP"; break;
case PRE_STEP1: stream << "PRE_STEP1"; break;
case PRE_STEP2: stream << "PRE_STEP2"; break;
case PRE_STEP3: stream << "PRE_STEP3"; break;
case PRE_STEP4: stream << "PRE_STEP4"; break;
case PRE_STEP5: stream << "PRE_STEP5"; break;
case PRE_STEP6: stream << "PRE_STEP6"; break;
case PRE_STEP7: stream << "PRE_STEP7"; break;
case PRE_FATAL: stream << "PRE_FATAL"; break;
case ALL_STEP : stream << "ALL_STEP"; break;
}
return stream;
}
/* -------------------------------------------------------------------------- */
class CommGroup {
public:
static const int id_all;
static const int id_none;
static const int id_invalid;
CommGroup(){
group_id = id_invalid;
}
CommGroup(int id){
this->setID(id);
}
bool operator == (CommGroup & grp){
return (grp.group_id == group_id);
}
bool operator != (CommGroup & grp){
return (grp.group_id != group_id);
}
void setID(int id){group_id = id;};
int getID(){return group_id;};
private:
int group_id;
};
/* -------------------------------------------------------------------------- */
enum PhysicalQuantity {
//physical quantities
Length,
Mass,
Energy,
Time,
MassDensity,
Force,
Pressure,
Temperature
};
/* -------------------------------------------------------------------------- */
// enum DDModelType {
// _DD2D,
// _PARADIS,
// };
/* -------------------------------------------------------------------------- */
/* describes the orientation of the edge dislo by indication which
* quadrant is shifted towards x=0*/
enum dislo_orientation {
TOP_RIGHT = 0 ,
TOP_LEFT = 1,
BOTTOM_RIGHT = 2,
BOTTOM_LEFT = 3
};
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
#endif /* __LIBMULTISCALE_LM_TYPES_HH__ */

Event Timeline