Mesh Oriented datABase
(version 5.6.0)
An array-based unstructured mesh library
SpectralMeshTool.hpp
Go to the documentation of this file.
1
#ifndef SPECTRALMESHTOOL_HPP
2
#define SPECTRALMESHTOOL_HPP
3
4
#include "
moab/Interface.hpp
"
// needs to be here to support inline query_interface
5
#include "
moab/Error.hpp
"
// needs to be here to support inline query_interface
6
#include <vector>
7
8
namespace
moab
9
{
10
11
/** \class SpectralMeshTool
12
* \brief Class with convenience functions for handling spectral mesh
13
* Class with convenience functions for handling spectral meshes. See description of spectral
14
* mesh handling in doc/metadata_info.doc and in the MOAB user's guide.
15
*
16
* There are two primary representations of spectral meshes:
17
* a) coarse elements: with SPECTRAL_VERTICES lexicographically-ordered array of fine vertices
18
* on each element, and tags on vertices or on elements (with _LEX suffix)
19
* b) fine elements: as linear elements made from fine vertices, with tags on vertices
20
*
21
*/
22
class
SpectralMeshTool
23
{
24
public
:
25
/** \brief Constructor
26
* \param impl MOAB Interface instance
27
* \param order Spectral order, defaults to 0
28
*/
29
SpectralMeshTool
(
Interface
* impl,
int
order = 0 );
30
31
/** \brief Destructor
32
*/
33
~SpectralMeshTool
();
34
35
/** \brief Return tag used to store lexicographically-ordered vertex array
36
* NOTE: If creating this tag with this call, this SpectralMeshTool instance must already have
37
* a non-zero spectral order value set on it; the size of the spectral vertices tag depends on
38
* this order.
39
* \param create_if_missing If true, will create this tag if it doesn't exist already
40
*/
41
Tag
spectral_vertices_tag
(
const
bool
create_if_missing =
false
);
42
43
/** \brief Return tag used to store spectral order
44
* \param create_if_missing If true, will create this tag if it doesn't exist already
45
*/
46
Tag
spectral_order_tag
(
const
bool
create_if_missing =
false
);
47
48
/** \brief Convert representation from coarse to fine
49
* Each element in set, or in interface if set is not input, is converted to fine elements,
50
* using vertices in SPECTRAL_VERTICES tagged array
51
* \param spectral_set Set containing spectral elements
52
*/
53
ErrorCode
convert_to_fine
(
EntityHandle
spectral_set );
54
55
/** \brief Convert representation from fine to coarse
56
* Each element in set, or in interface if set is not input, is converted to coarse elements,
57
* with fine vertices put into SPECTRAL_VERTICES tagged array. NOTE: This function assumes that
58
* each order^d (fine) elements comprise each coarse element, and are in order of fine elements
59
* in each coarse element. If order is input as 0, looks for a SPECTRAL_ORDER tag on the mesh.
60
* \param order Order of the spectral mesh
61
* \param spectral_set Set containing spectral elements
62
*/
63
ErrorCode
convert_to_coarse
(
int
order = 0,
EntityHandle
spectral_set = 0 );
64
65
/** \brief Create coarse spectral elements from fine elements pointed to by conn
66
* This function creates the coarse elements by taking conn (assumed to be in FE ordering)
67
* and picking out the corner vertices to make coarse connectivity, and the other vertices
68
* (along with corners) to make SPECTRAL_VERTICES array pointed to by each entity.
69
* \param conn Connectivity of fine (linear) elements, in FE ordering
70
* \param num_fine_elems Number of fine elements represented by conn
71
* \param dim Dimension of the mesh
72
* \param output_range Range to store created coarse elements
73
* \param start_idx Starting index in conn (for parallel support)
74
* \param local_gids If non-null, will insert all fine vertices into this range
75
*/
76
template
<
class
T >
77
ErrorCode
create_spectral_elems
(
const
T* conn,
78
int
num_fine_elems,
79
int
dim,
80
Range
& output_range,
81
int
start_idx = 0,
82
Range
* local_gids = NULL );
83
84
/** \brief Set spectral order for this instance
85
* \param order Order set on this instance
86
*/
87
void
spectral_order
(
int
order )
88
{
89
spectralOrder
= order;
90
spectralOrderp1
= order + 1;
91
}
92
93
/** \brief Get spectral order for this instance
94
* \return order Order set on this instance
95
*/
96
int
spectral_order
()
97
{
98
return
spectralOrder
;
99
}
100
/*
101
struct ConnMap
102
{
103
const short a[16];
104
};
105
*/
106
static
const
short
int
permute_array
[];
107
108
static
const
short
int
lin_permute_array
[];
109
110
private
:
111
//! the MB instance that this works with
112
Interface
*
mbImpl
;
113
114
//! error object for this tool
115
Error
*
mError
;
116
117
//! SPECTRAL_VERTICES tag
118
Tag
svTag
;
119
120
//! SPECTRAL_ORDER tag
121
Tag
soTag
;
122
123
//! order of the spectral mesh being accessed
124
int
spectralOrder
;
125
126
//! order of the spectral mesh being accessed plus one
127
int
spectralOrderp1
;
128
};
129
130
inline
SpectralMeshTool::SpectralMeshTool
(
Interface
* impl,
int
order )
131
: mbImpl( impl ), svTag( 0 ), soTag( 0 ), spectralOrder( order ), spectralOrderp1( order + 1 )
132
{
133
impl->
query_interface
(
mError
);
134
}
135
136
inline
SpectralMeshTool::~SpectralMeshTool
() {}
137
138
}
// namespace moab
139
140
#endif
src
moab
SpectralMeshTool.hpp
Generated on Wed Jun 3 2026 02:04:41 for Mesh Oriented datABase by
1.9.1.