Flow123d  jenkins-Flow123d-linux-release-multijob-282
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  // Misc
105  int aux; // Auxiliary flag
106 };
107 
108 #endif
109 //-----------------------------------------------------------------------------
110 // vim: set cindent:
double getY() const
Definition: nodes.hh:71
Definition: nodes.hh:44
arma::vec3 operator-(const Node &n2) const
Definition: nodes.hh:89
double distance(const Node &n2) const
Definition: nodes.hh:98
arma::vec3 coordinates
Node point in 3D space.
Definition: nodes.hh:47
double getZ() const
Definition: nodes.hh:73
Global macros to enhance readability and debugging, general constants.
double getX() const
Definition: nodes.hh:69
int aux
Definition: nodes.hh:105
const arma::vec3 & point() const
Definition: nodes.hh:83
arma::vec3 & point()
Definition: nodes.hh:80