Flow123d
release_3.0.0-968-gc87a28e79
flow123d
src
mesh
nodes.hh
Go to the documentation of this file.
1
/*!
2
*
3
* Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4
*
5
* This program is free software; you can redistribute it and/or modify it under
6
* the terms of the GNU General Public License version 3 as published by the
7
* Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
*
13
*
14
* @file nodes.hh
15
* @brief Nodes of a mesh.
16
*/
17
18
#ifndef NODE_H
19
#define NODE_H
20
21
#include "
system/global_defs.h
"
22
#include <armadillo>
23
24
25
26
27
/**
28
* Class of node.
29
* First approach in turning to class.
30
*/
31
class
Node
{
32
private
:
33
/// Node point in 3D space.
34
arma::vec3
coordinates
;
35
36
public
:
37
/**
38
* Default constructor.
39
*/
40
Node
()
41
//: element(NULL)
42
{
coordinates
.zeros();}
43
44
/**
45
* Construct form given coordinates.
46
*
47
* Possibly there could be also constructor from a vector.
48
*/
49
Node
(
double
x,
double
y,
double
z)
50
//: element(NULL)
51
{
coordinates
(0)=x;
coordinates
(1)=y;
coordinates
(2)=z;}
52
53
/**
54
* Old getter methods. OBSOLETE.
55
*/
56
inline
double
getX
()
const
57
{
return
coordinates
[0];}
58
inline
double
getY
()
const
59
{
return
coordinates
[1];}
60
inline
double
getZ
()
const
61
{
return
coordinates
[2];}
62
63
64
/**
65
* Getter method for nodal point. Can be used also for modification.
66
*/
67
inline
arma::vec3
&
point
()
68
{
return
coordinates
; }
69
70
inline
const
arma::vec3
&
point
()
const
71
{
return
coordinates
; }
72
73
/**
74
* Difference of two nodes is a vector.
75
*/
76
inline
arma::vec3
operator-
(
const
Node
&n2)
const
77
{
78
return
( this->
point
() - n2.
point
() );
79
}
80
81
82
/**
83
* Distance of two nodes.
84
*/
85
inline
double
distance
(
const
Node
&n2)
const
86
{
87
return
norm(*
this
- n2, 2);
88
}
89
90
};
91
92
#endif
93
//-----------------------------------------------------------------------------
94
// vim: set cindent:
arma::vec3
Definition:
doxy_dummy_defs.hh:17
Node::point
const arma::vec3 & point() const
Definition:
nodes.hh:70
Node::getX
double getX() const
Definition:
nodes.hh:56
Node::point
arma::vec3 & point()
Definition:
nodes.hh:67
Node::getZ
double getZ() const
Definition:
nodes.hh:60
Node::getY
double getY() const
Definition:
nodes.hh:58
Node
Definition:
nodes.hh:31
global_defs.h
Global macros to enhance readability and debugging, general constants.
Node::Node
Node()
Definition:
nodes.hh:40
Node::operator-
arma::vec3 operator-(const Node &n2) const
Definition:
nodes.hh:76
Node::distance
double distance(const Node &n2) const
Definition:
nodes.hh:85
Node::Node
Node(double x, double y, double z)
Definition:
nodes.hh:49
Node::coordinates
arma::vec3 coordinates
Node point in 3D space.
Definition:
nodes.hh:34
Generated by
1.8.17