Page MenuHomec4science

ref_node_meca1d.hh
No OneTemporary

File Metadata

Created
Sat, Nov 16, 03:02

ref_node_meca1d.hh

/**
* @file ref_node_meca1d.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Sun Feb 02 17:45:17 2014
*
* @brief Reference to nodal DOF in MECA1D
*
* @section LICENSE
*
* Copyright INRIA and CEA
*
* The LibMultiScale is a C++ parallel framework for the multiscale
* coupling methods dedicated to material simulations. This framework
* provides an API which makes it possible to program coupled simulations
* and integration of already existing codes.
*
* This Project was initiated in a collaboration between INRIA Futurs Bordeaux
* within ScAlApplix team and CEA/DPTA Ile de France.
* The project is now continued at the Ecole Polytechnique Fédérale de Lausanne
* within the LSMS/ENAC laboratory.
*
* This software is governed by the CeCILL-C license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL-C
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*
*/
#ifndef __LIBMULTISCALE_REF_NODE_MECA1D_HH__
#define __LIBMULTISCALE_REF_NODE_MECA1D_HH__
/* -------------------------------------------------------------------------- */
#include "ref_node_continuum.hh"
#include "mesh_meca1d.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
class DomainMeca1D;
class ComparatorRefNodeMeca1D;
/* -------------------------------------------------------------------------- */
/**
* Class RefNodeLibMesh
* implementation by libmesh to generic access
* to nodes
*/
class RefNodeMeca1D :public RefNode<1>
{
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
public:
//! generic container of the original model container
typedef DomainMeca1D Domain;
//! node comparator class to be usable in maps
typedef ComparatorRefNodeMeca1D RefComparator;
static const UInt Dim = 1;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
RefNodeMeca1D():mesh(NULL){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
bool operator == (RefNodeMeca1D & ref){
return (ref.index == index);
};
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
//! return the index to node. Should be used carrefully
UInt getIndex(){
return index;
};
//! give acess to the alpha values
Real & alpha(){return mesh->alpha[index];}
//! return acceleration value for dimention coord
Real & force(UInt coord){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
return mesh->f[index];
};
Real & acceleration(UInt coord){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
return mesh->f[index];
};
//! return temperature value
Real & temperature(){
return mesh->T[index];
};
//! return temperature variation value
Real & temperatureVar(){
return mesh->Tdt[index];
};
//! return the external heat rate value
Real & externalHeatRate(){
return mesh->external_heat_rate[index];
};
//! return the external heat rate value
Real & heatRate(){
return mesh->heat_rate[index];
};
//! return thermal diffusivity
Real & capacity(){
LM_TOIMPLEMENT;
};
//! return initial position value for dimention coord
Real & position0(UInt coord){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
return mesh->p0[index];
};
//! return displacement value for dimension coord
Real & displacement(UInt coord){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
return mesh->u[index];
};
//! return actual position for dimension coord
AccessorNodalDof<1,_position> position(UInt coord){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
return AccessorNodalDof<1,_position>(*this,coord);
};
//! return velocity value for dimention coord
Real & velocity(UInt coord){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
return mesh->v[index];
};
//! read or set boundary value
bool & boundary(UInt coord){
this->boundary_dummy = false;
DUMP("MECA1D doensn't know how to deal with boundaries! This does nothing."
, DBG_WARNING);
return this->boundary_dummy;
}
//! return mass value
Real & mass(){
return mesh->m[index];
};
UInt id(){
return index;
};
//! set displacement value for dimention coord
void setDisplacement(UInt coord,Real value){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
mesh->u[index] = value;
};
//! set velocity value for dimention coord
void setVelocity(UInt coord,Real value){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
mesh->v[index] = value;
};
//! set accelartion value for dimention coord
void setForce(UInt coord,Real value){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
mesh->f[index] = value;
};
//! set accelartion value for dimention coord
void setAcceleration(UInt coord,Real value){
LM_ASSERT(coord == 0,"1D model cannot access to coord " << coord);
mesh->f[index] = value;
};
//! set temperature value
void setTemperature(Real value){
mesh->T[index] = value;
};
//! return temperature variation value
void setTemperatureVar(Real value){
mesh->Tdt[index] = value;
};
protected:
//! iterators need to access model field
friend class IteratorNodesMeca1D;
//! containers need to access index field
friend class ContainerNodesMeca1D;
friend class RefElemMeca1D;
//! set the index to node. Should be used carrefully
void setIndex(UInt i){
index = i;
};
//! set the mesh pointer used to access the data
void setMesh(MeshMeca1D * ptr){
mesh = ptr;
};
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
//! pointer to the mesh
MeshMeca1D * mesh;
//! index refereing to the current node
UInt index;
//! dummy boundary value
bool boundary_dummy;
};
/* -------------------------------------------------------------------------- */
inline std::ostream& operator << (std::ostream& os,RefNodeMeca1D & ref){
UInt n = ref.getIndex();
os << "Akantu Node reference : " << n
<< " [P] " << ref.position(0)
<< " [P0] " << ref.position0(0)
<< " [V] " << ref.velocity(0)
<< " [F] " << ref.force(0);
return os;
}
/* -------------------------------------------------------------------------- */
class ComparatorRefNodeMeca1D{
public:
bool operator()(RefNodeMeca1D & r1,RefNodeMeca1D & r2) const{
LM_TOIMPLEMENT;
}
bool operator()(const RefNodeMeca1D & r1,const RefNodeMeca1D & r2) const{
LM_TOIMPLEMENT;
}
};
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_REF_NODE_MECA1D_HH__ */

Event Timeline