Flow123d
nodes.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2007 Technical University of Liberec. All rights reserved.
4  *
5  * Please make a following refer to Flow123d on your project site if you use the program for any purpose,
6  * especially for academic research:
7  * Flow123d, Research Centre: Advanced Remedial Technologies, Technical University of Liberec, Czech Republic
8  *
9  * This program is free software; you can redistribute it and/or modify it under the terms
10  * of the GNU General Public License version 3 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with this program; if not,
17  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
18  *
19  *
20  * $Id$
21  * $Revision$
22  * $LastChangedBy$
23  * $LastChangedDate$
24  *
25  * @file
26  * @brief Nodes of a mesh.
27  *
28  */
29 
30 #ifndef NODE_H
31 #define NODE_H
32 
33 #include "system/global_defs.h"
34 #include "mesh/mesh_types.hh"
35 #include <armadillo>
36 
37 
38 
39 
40 /**
41  * Class of node.
42  * First approach in turning to class.
43  */
44 class Node {
45 private:
46  /// Node point in 3D space.
48 
49 public:
50  /**
51  * Default constructor.
52  */
53  Node()
54  //: element(NULL)
55  {coordinates.zeros();}
56 
57  /**
58  * Construct form given coordinates.
59  *
60  * Possibly there could be also constructor from a vector.
61  */
62  Node(double x, double y, double z)
63  //: element(NULL)
64  {coordinates(0)=x; coordinates(1)=y; coordinates(2)=z;}
65 
66  /**
67  * Old getter methods. OBSOLETE.
68  */
69  inline double getX() const
70  { return coordinates[0];}
71  inline double getY() const
72  {return coordinates[1];}
73  inline double getZ() const
74  {return coordinates[2];}
75 
76 
77  /**
78  * Getter method for nodal point. Can be used also for modification.
79  */
80  inline arma::vec3 &point()
81  { return coordinates; }
82 
83  inline const arma::vec3 &point() const
84  { return coordinates; }
85 
86  /**
87  * Difference of two nodes is a vector.
88  */
89  inline arma::vec3 operator-(const Node &n2) const
90  {
91  return ( this->point() - n2.point() );
92  }
93 
94 
95  /**
96  * Distance of two nodes.
97  */
98  inline double distance(const Node &n2) const
99  {
100  return norm(*this - n2, 2);
101  }
102 
103  //--------------------------------------------------------------------------
104  // Old data - adepts to remove ...
105  //--------------------------------------------------------------------------
106 
107  //int id; // this is used in old output TODO: remove after application new output
108 
109  // Topology
110  // int n_elements; // # of elms connected by the node ( used only in transport )
111  // ElementIter *element; // List of elements
112 
113  // following is used only by interpolation function
114  // postprocess.c void make_node_scalar(Mesh* mesh)
115  // which should be rewrittento be able interpolate arbitrary data
116  // Results
117  //double scalar; // Scalar quantity (pressure/piez. head)
118 
119  // Misc
120  int aux; // Auxiliary flag
121  //double faux; // Auxiliary number
122 };
123 
124 /**
125  * Binary operators (and functions) operating on nodes.
126  */
127 
128 #endif
129 //-----------------------------------------------------------------------------
130 // vim: set cindent: