COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
MagmaUtils.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 // CLASS MagmaUtils
10 //
11 // Neighbourhood calculation for nodes and cells.
12 // You get also a function which calculates the border (lines)
13 // of a polygon. And other functions, which extend a surface beyond
14 // its borders, eventually with data.
15 //
16 // Initial version: 29.02.2004 Sergio Leseduarte
17 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18 // (C) 2004 by VirCinity IT Consulting
19 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 // Changes:
21 
22 #ifndef _MAGMA_UTILS_H_
23 #define _MAGMA_UTILS_H_
24 
25 #include "covise/covise.h"
26 
27 namespace covise
28 {
29 
31 {
32 public:
33  typedef std::pair<int, int> Edge;
34  // NodeNeighbours calculates in neighbours the neighbours
35  // cells for each node. start_neigh is used to get the starting
36  // position in neighbours of the neighbours of a node, and number_neigh
37  // is used to get the number of cell neighbours.
38  // num_conn gives for each cell the number of vertices,
39  // this may seem redundant with el, but it is not, when you are
40  // using a subgrid.
41  static void NodeNeighbours(const vector<int> &el,
42  const vector<int> &num_conn,
43  const vector<int> &cl,
44  int num_coord, // this is in most cases redundant...
45  // but not always!!!
46  vector<int> &start_neigh,
47  vector<int> &number_neigh,
48  vector<int> &neighbours);
49  // CellNeighbours calculates in elem_neighbours the neighbours
50  // cells for each cell. Two cells are neighbours in this context
51  // not when they have one common node, but when they have one common edge.
52  // For the meaning of elem_start_neigh, elem_number_neigh and
53  // elem_neighbours, you may read the comments for NodeNeighbours.
54  // edge_neighbours is as long as elem_neighbours. For each
55  // neighbourhood relationship, a (the) common edge is kept in this array.
56  // In general, you will have to use NodeNeighbours prior
57  // calling CellNeighbours.
58  static void CellNeighbours(const vector<int> &el,
59  const vector<int> &num_conn,
60  const vector<int> &cl,
61  // these fields come from NodeNeighbours
62  const vector<int> &nodal_start_neigh,
63  const vector<int> &nodal_number_neigh,
64  const vector<int> &nodal_neighbours, // elements touching a node
65  vector<int> &elem_start_neigh,
66  vector<int> &elem_number_neigh,
67  vector<int> &elem_neighbours,
68  vector<Edge> &edge_neighbours);
69  // The output of DomainLines are two arrays: border_els, the
70  // cells lying at the border, and border_edges, the edges defining
71  // the border. You have to call CellNeighbours before using
72  // this function.
73  static void DomainLines(const vector<int> &el,
74  const vector<int> &num_conn,
75  const vector<int> &cl,
76  const vector<int> &elem_start_neigh,
77  const vector<int> &elem_number_neigh,
78  const vector<Edge> &edge_neighbours,
79  vector<int> &border_els,
80  vector<Edge> &border_edges);
81  // the following two functions work at the moment
82  // only for triangles!!!!
83  // You are likely to append clExt and {x,y,z}Ext to cl and x,y,z
84  // after calling these functions in order to get the whole
85  // extended geometry
86  static void ExtendBorder(float length, const vector<int> &border_els,
87  const vector<Edge> &border_edges,
88  const vector<int> &cl,
89  vector<int> &clExt,
90  const vector<float> &x,
91  const vector<float> &y, const vector<float> &z,
92  vector<float> &xExt,
93  vector<float> &yExt, vector<float> &zExt);
94  static void ExtendBorderAndData(float length, const vector<int> &border_els,
95  const vector<Edge> &border_edges,
96  const vector<int> &cl,
97  vector<int> &clExt,
98  const vector<float> &x,
99  const vector<float> &y, const vector<float> &z,
100  const vector<float> &InData,
101  vector<float> &xExt,
102  vector<float> &yExt, vector<float> &zExt,
103  vector<float> &OutData); // extended data
104 };
105 }
106 #endif
std::pair< int, int > Edge
Definition: MagmaUtils.h:33
GLdouble GLdouble z
Definition: khronos-glext.h:6565
GLenum GLuint GLenum GLsizei length
Definition: khronos-glext.h:6279
GLint GLint GLint GLint GLint GLint y
Definition: khronos-glext.h:6346
Definition: MagmaUtils.h:30
GLint GLint GLint GLint GLint x
Definition: khronos-glext.h:6346
#define ALGEXPORT
Definition: coExport.h:325