Developer Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
PluginFunctionsHexahedralMesh.cc
1
/*===========================================================================*\
2
* *
3
* OpenFlipper *
4
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
5
* www.openflipper.org *
6
* *
7
*--------------------------------------------------------------------------- *
8
* This file is part of OpenFlipper. *
9
* *
10
* OpenFlipper is free software: you can redistribute it and/or modify *
11
* it under the terms of the GNU Lesser General Public License as *
12
* published by the Free Software Foundation, either version 3 of *
13
* the License, or (at your option) any later version with the *
14
* following exceptions: *
15
* *
16
* If other files instantiate templates or use macros *
17
* or inline functions from this file, or you compile this file and *
18
* link it with other files to produce an executable, this file does *
19
* not by itself cause the resulting executable to be covered by the *
20
* GNU Lesser General Public License. This exception does not however *
21
* invalidate any other reasons why the executable file might be *
22
* covered by the GNU Lesser General Public License. *
23
* *
24
* OpenFlipper is distributed in the hope that it will be useful, *
25
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
26
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27
* GNU Lesser General Public License for more details. *
28
* *
29
* You should have received a copy of the GNU LesserGeneral Public *
30
* License along with OpenFlipper. If not, *
31
* see <http://www.gnu.org/licenses/>. *
32
* *
33
\*===========================================================================*/
34
35
/*===========================================================================*\
36
* *
37
* $Revision: 13489 $ *
38
* $LastChangedBy: kremer $ *
39
* $Date: 2012-01-25 12:30:09 +0100 (Wed, 25 Jan 2012) $ *
40
* *
41
\*===========================================================================*/
42
43
#include <
OpenFlipper/common/Types.hh
>
44
45
#include <
ObjectTypes/HexahedralMesh/PluginFunctionsHexahedralMesh.hh
>
46
#include <
OpenFlipper/BasePlugin/PluginFunctions.hh
>
47
48
namespace
PluginFunctions {
49
50
// ===============================================================================
51
// Get source meshes
52
// ===============================================================================
53
54
55
bool
getSourceMeshes
( std::vector<HexahedralMesh*>& _meshes )
56
{
57
_meshes.clear();
58
59
for
(
ObjectIterator
o_it(
PluginFunctions::SOURCE_OBJECTS
,
DATA_HEXAHEDRAL_MESH
) ;
60
o_it !=
PluginFunctions::objectsEnd
(); ++o_it) {
61
_meshes.push_back (
PluginFunctions::hexahedralMesh
( *o_it ) );
62
if
( _meshes.back() == NULL)
63
std::cerr <<
"ERROR: HexahedralMesh getSourceMeshes fatal error\n"
;
64
}
65
66
return
( !_meshes.empty() );
67
}
68
69
70
// ===============================================================================
71
// Get target meshes
72
// ===============================================================================
73
74
75
bool
getTargetMeshes
( std::vector<HexahedralMesh*>& _meshes )
76
{
77
_meshes.clear();
78
79
for
(
ObjectIterator
o_it(
PluginFunctions::TARGET_OBJECTS
,
DATA_HEXAHEDRAL_MESH
) ;
80
o_it !=
PluginFunctions::objectsEnd
(); ++o_it) {
81
_meshes.push_back (
PluginFunctions::hexahedralMesh
( *o_it ) );
82
if
( _meshes.back() == NULL)
83
std::cerr <<
"ERROR: HexahedralMesh getTargetMeshes fatal error\n"
;
84
}
85
86
return
( !_meshes.empty() );
87
}
88
89
90
// ===============================================================================
91
// Get objects
92
// ===============================================================================
93
94
bool
getObject
(
int
_identifier,
HexahedralMeshObject
*& _object ) {
95
96
if
( _identifier == -1 ) {
97
_object = 0;
98
return
false
;
99
}
100
101
BaseObject
*
object
=
objectRoot
()->
childExists
( _identifier );
102
_object =
dynamic_cast<
HexahedralMeshObject
*
>
(object);
103
return
( _object != 0 );
104
}
105
106
107
// ===============================================================================
108
// Getting data from objects and casting between them
109
// ===============================================================================
110
111
HexahedralMesh
*
hexahedralMesh
(
BaseObjectData
* _object ) {
112
113
if
( _object->
dataType
(
DATA_HEXAHEDRAL_MESH
) ) {
114
HexahedralMeshObject
*
object
=
dynamic_cast<
HexahedralMeshObject
*
>
(_object);
115
return
object
->
mesh
();
116
}
else
117
return
0;
118
}
119
120
121
HexahedralMeshObject
*
hexahedralMeshObject
(
BaseObjectData
* _object ) {
122
if
( ! _object->
dataType
(
DATA_HEXAHEDRAL_MESH
) )
123
return
0;
124
return
dynamic_cast<
HexahedralMeshObject
*
>
( _object );
125
}
126
127
128
HexahedralMeshObject
*
hexahedralMeshObject
(
int
_identifier )
129
{
130
HexahedralMeshObject
* pol_obj;
131
if
(
getObject
(_identifier, pol_obj))
132
return
pol_obj;
133
else
134
return
0;
135
}
136
137
138
}
ObjectTypes
HexahedralMesh
PluginFunctionsHexahedralMesh.cc
Generated on Mon Jul 16 2012 17:06:09 for Developer Documentation by
1.8.1.2