00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __NODE_H
00034 #define __NODE_H
00035
00036 #include <stdlib.h>
00037 #include <math.h>
00038
00039 #include <iostream>
00040 using std::ostream;
00041 using std::endl;
00042 using std::cerr;
00043
00044 #include <iomanip>
00045 using std::setw;
00046
00047 #include "OFELI_Config.h"
00048 #include "Point.h"
00049
00050 namespace OFELI {
00051
00056 class Element;
00057 class Side;
00058 class Mesh;
00059
00060
00061
00062
00063
00064 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00065 struct ErrorInNode {
00066 void Message(const char *file, size_t line, int code, int p1=0);
00067 };
00068 #endif
00069
00070
00071
00072
00073
00083 class Node
00084 {
00085
00086 public:
00087
00088
00089
00092 Node();
00093
00096 Node(size_t label, const Point<double> &x);
00097
00099 Node(const Node &node);
00100
00102 ~Node();
00103
00104
00105
00107 void setLabel(size_t label) { _label = label; }
00108
00110 void setNbDOF(size_t n);
00111
00113 void setFirstDOF(size_t n) { _first_dof = n; }
00114
00118 void setCode(size_t dof, int code);
00119
00122 void setCode(int *code);
00123
00127 void setCoord(size_t i, double x) { _x[i-1] = x; }
00128
00132 void DOF(size_t i, size_t dof) { _dof[i-1] = dof; }
00133
00137 void setDOF(size_t &first_dof, size_t nb_dof);
00138
00141 void setOnBoundary() { _on_boundary = true; }
00142
00143
00144
00146 size_t getLabel() const { return _label; }
00147
00149 size_t getNbDOF() const { return _nb_dof; }
00150
00152 int getCode(size_t dof) const { return _code[dof-1]; }
00153
00156 double getCoord(size_t i) const { return _x[i-1]; }
00157
00160 Point<double> getCoord() const { return Point<double>(_x[0],_x[1],_x[2]); }
00161
00163 size_t getDOF(size_t i) const { return _dof[i-1]; }
00164
00169 size_t getNbNeigEl() const { return _nb_neig_el; }
00170
00174 Element *getNeigEl(size_t i) const { return _el[i-1]; }
00175
00177 size_t getFirstDOF() const { return _first_dof; }
00178
00182 bool getOnBoundary() const { return _on_boundary; }
00183
00185 void Add(Element *el);
00186
00187 friend class Mesh;
00188 friend void Refine(Mesh &in_mesh, Mesh &out_mesh);
00189 friend ostream& operator<<(ostream& s, const Mesh &ms);
00190
00191 private:
00192
00193 size_t _nb_dof, _first_dof, _label, _nb_neig_el, _neig_i;
00194 size_t _dof[MAX_NBDOF_NODE];
00195 int _code[MAX_NBDOF_NODE];
00196 Point<double> _x;
00197 Element **_el;
00198 bool _alive, _on_boundary;
00199 ErrorInNode _e;
00200
00201 void Neig() { _nb_neig_el++; }
00202 void Add() { _el = new Element * [_nb_neig_el]; }
00203
00204 };
00205
00206
00207
00208
00209
00210
00214 ostream & operator<<(ostream& s, const Node &nd);
00215
00216 }
00217
00218 #endif