ECOGEN 4.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
Element.h
Go to the documentation of this file.
1//
2// ,---. ,--, .---. ,--, ,---. .-. .-.
3// | .-' .' .') / .-. ) .' .' | .-' | \| |
4// | `-. | |(_) | | |(_) | | __ | `-. | | |
5// | .-' \ \ | | | | \ \ ( _) | .-' | |\ |
6// | `--. \ `-. \ `-' / \ `-) ) | `--. | | |)|
7// /( __.' \____\ )---' )\____/ /( __.' /( (_)
8// (__) (_) (__) (__) (__)
9// Official webSite: https://code-mphi.github.io/ECOGEN/
10//
11// This file is part of ECOGEN.
12//
13// ECOGEN is the legal property of its developers, whose names
14// are listed in the copyright file included with this source
15// distribution.
16//
17// ECOGEN is free software: you can redistribute it and/or modify
18// it under the terms of the GNU General Public License as published
19// by the Free Software Foundation, either version 3 of the License,
20// or (at your option) any later version.
21//
22// ECOGEN is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with ECOGEN (file LICENSE).
29// If not, see <http://www.gnu.org/licenses/>.
30
31#ifndef ELEMENT_H
32#define ELEMENT_H
33
34#include <fstream>
35#include <sstream>
36#include "../Maths/Coord.h"
37#include "../Maths/GeometricObject.h"
38#include "../Errors.h"
39#include "../Tools.h"
40#include "../Parallel/key.hpp"
41
42class Element;
43
44#include "Face.h"
45
47{
48public:
49 Element();
50 virtual ~Element();
51
52 //Accesseurs
54 const Coord& getPosition() const { return m_position; };
55 const double& getLCFL() const { return m_lCFL; };
56 const double& getVolume() const { return m_volume; };
57 const int& getNumCellAssociee() const { return m_numCellAssociee; };
58
59 virtual const int& getIndex() const { Errors::errorMessage("getIndex not available for requested element"); return Errors::defaultInt; };
60 virtual const int& getAppartenancePhysique() const { return Errors::defaultInt; };
61 virtual void setVolume(const double& /*volume*/){ Errors::errorMessage("setVolume not available for requested element"); };
62 virtual void setLCFL(const double& /*lCFL*/){ Errors::errorMessage("setlCFL not available for requested element"); };
63 virtual void setPos(const double& /*X*/, const double& /*Y*/, const double& /*Z*/){ Errors::errorMessage("setPos not available for requested element"); };
64 virtual void setPos(const Coord& /*pos*/) { Errors::errorMessage("setPos not available for requested element"); };
65 virtual void setPosX(const double& /*X*/) { Errors::errorMessage("setPosX not available for requested element"); };
66 virtual void setPosY(const double& /*Y*/) { Errors::errorMessage("setPosY not available for requested element"); };
67 virtual void setPosZ(const double& /*Z*/) { Errors::errorMessage("setPosZ not available for requested element"); };
68 virtual void setSize(const double& /*sizeX*/, const double& /*sizeY*/, const double& /*sizeZ*/) { Errors::errorMessage("setSize not available for requested element"); };
69 virtual void setSize(const Coord& /*size*/) { Errors::errorMessage("setSize not available for requested element"); };
70
71 void writePos(std::ofstream& fileStream, Axis axis);
72
73 virtual void printInfo() const{ Errors::errorMessage("AfficheInfos not available for requested element"); };
74
75 Coord vector(const Element* e);
76 Coord vector(const Face* f);
78 double distance(const Element* e);
79 double distanceX(const Element* e);
80 double distanceY(const Element* e);
81 double distanceZ(const Element* e);
82 double distance(const Face* f);
83 double distanceX(const Face* f);
84 double distanceY(const Face* f);
85 double distanceZ(const Face* f);
87 virtual const double& getSizeX() { Errors::errorMessage("getSizeX not available for requested element"); return Errors::defaultDouble; };
88 virtual const double& getSizeY() { Errors::errorMessage("getSizeY not available for requested element"); return Errors::defaultDouble; };
89 virtual const double& getSizeZ() { Errors::errorMessage("getSizeZ not available for requested element"); return Errors::defaultDouble; };
90 virtual const Coord& getSize() { Errors::errorMessage("getSize not available for requested element"); return Coord::defaultCoord; };
91
92 bool traverseObjet(const GeometricObject &objet) const;
93
94 //Pour methode AMR
95 virtual void creerElementChild() { Errors::errorMessage("creerElementsChildren not available for requested element"); };
96 virtual Element* getElementChild(const int& /*numberChild*/) { Errors::errorMessage("getElementChild not available for requested element"); return 0; };
97 virtual Element* getElementChildBack() { Errors::errorMessage("getElementChild not available for requested element"); return 0; };
98 virtual void finalizeElementsChildren() { Errors::errorMessage("finalizeElementsChildren not available for requested element"); };
99
100 //For parallel load balancing
101 virtual void setKey(const decomposition::Key<3>& key);
102 virtual const decomposition::Key<3>& getKey() const { return m_key; };
103
104protected:
105
107 double m_volume;
108 double m_lCFL;
111};
112
113#endif // ELEMENT_H
Axis
Enumeration for the axes (X, Y and Z for the axes in the x-, y- and z-direction)
Definition Tools.h:42
Class for a coordinate system object such as coordinates of the vertex or a vector.
Definition Coord.h:43
static const Coord defaultCoord
Default Coord object (const version)
Definition Coord.h:55
Definition Element.h:47
virtual ~Element()
Definition Element.cpp:39
decomposition::Key< 3 > m_key
Definition Element.h:110
int m_numCellAssociee
Definition Element.h:109
virtual const double & getSizeY()
Definition Element.h:88
Coord vector(const Element *e)
Definition Element.cpp:59
virtual Element * getElementChild(const int &)
Definition Element.h:96
virtual const int & getIndex() const
Definition Element.h:59
virtual void setVolume(const double &)
default
Definition Element.h:61
void setCellAssociee(const int &numCell)
Definition Element.h:53
const double & getLCFL() const
Definition Element.h:55
double distanceX(const Element *e)
Definition Element.cpp:85
virtual void creerElementChild()
Definition Element.h:95
virtual Element * getElementChildBack()
Definition Element.h:97
const double & getVolume() const
Definition Element.h:56
virtual const int & getAppartenancePhysique() const
Definition Element.h:60
double m_lCFL
Definition Element.h:108
virtual void setKey(const decomposition::Key< 3 > &key)
Definition Element.cpp:153
virtual void setSize(const Coord &)
Definition Element.h:69
bool traverseObjet(const GeometricObject &objet) const
Definition Element.cpp:141
virtual void setSize(const double &, const double &, const double &)
Definition Element.h:68
virtual const Coord & getSize()
Definition Element.h:90
virtual void setPos(const double &, const double &, const double &)
Definition Element.h:63
double distanceZ(const Element *e)
Definition Element.cpp:101
const int & getNumCellAssociee() const
Definition Element.h:57
Element()
Definition Element.cpp:35
virtual const double & getSizeX()
Definition Element.h:87
virtual void setPos(const Coord &)
Definition Element.h:64
double distance(const Element *e)
Definition Element.cpp:77
virtual void setPosX(const double &)
Definition Element.h:65
virtual void setPosZ(const double &)
Definition Element.h:67
double m_volume
Definition Element.h:107
virtual const decomposition::Key< 3 > & getKey() const
Definition Element.h:102
virtual void setLCFL(const double &)
Definition Element.h:62
virtual void printInfo() const
Definition Element.h:73
double distanceY(const Element *e)
Definition Element.cpp:93
void writePos(std::ofstream &fileStream, Axis axis)
Definition Element.cpp:43
virtual void setPosY(const double &)
Definition Element.h:66
virtual void finalizeElementsChildren()
Definition Element.h:98
Coord m_position
Definition Element.h:106
virtual const double & getSizeZ()
Definition Element.h:89
const Coord & getPosition() const
Definition Element.h:54
static constexpr int defaultInt
Definition Errors.h:91
static void errorMessage(const std::string &message)
Definition Errors.cpp:56
static constexpr double defaultDouble
Definition Errors.h:93
Definition Face.h:42
Abstract class for geometric object.
Definition GeometricObject.h:41
Definition key.hpp:50