Overture
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
Overture.v25.d
include
TrimmedMapping.h
Go to the documentation of this file.
1
#ifndef TRIMMED_MAPPING_H
2
#define TRIMMED_MAPPING_H
3
4
#include "
Mapping.h
"
5
#include "
NurbsMapping.h
"
6
//#include "PlotStuff.h"
7
#include "
GenericGraphicsInterface.h
"
8
9
#define OLDSTUFF
10
#undef OLDSTUFF
11
12
class
TMquad
;
13
class
TMquadRoot
;
14
class
UnstructuredMapping
;
15
16
//---------------------------------------------------------------
17
// Define a Trimmed Mapping:
18
// A trimmed surface has curves defined on it (in parameter space)
19
// that "remove" parts the surface.
20
//---------------------------------------------------------------
21
class
TrimmedMapping
:
public
Mapping
22
{
23
public
:
// private // ************************************************
24
aString
className
;
25
Mapping
*
surface
;
// here is the surface to be trimmed
26
27
#ifdef OLDSTUFF
28
int
numberOfInnerCurves
;
// number of curves that trim the surface
29
Mapping
*
outerCurve
;
30
Mapping
**
innerCurve
;
// Here are the curves that trim the surface
31
#else
32
Mapping
**trimCurves;
// all the curves that trim the surface (including the boundary)
33
intArray trimOrientation;
// orientations of the curves : 1 clockwise, -1 counterclockwise
34
int
numberOfTrimCurves;
35
#endif
36
37
bool
isInitialized
() {
return
upToDate
; }
38
void
setUnInitialized
();
39
40
bool
trimmingIsValid
() {
return
validTrimming
; }
41
int
validateTrimming
();
42
void
manuallyValidateTrimming
() {
validTrimming
=
true
; }
43
void
invalidateTrimming
() {
validTrimming
=
false
; }
// can only be turned true by call to validateTrimming
44
45
bool
verifyTrimCurve
(
Mapping
*curve );
46
47
void
initializeTrimCurves
();
48
49
aString
reportTrimCurveInfo
(
Mapping
*curve,
bool
&curveok);
50
aString
reportTrimmingInfo
() ;
51
52
bool
addTrimCurve
(
Mapping
*trimCurve);
53
bool
deleteTrimCurve
(
int
curveToDelete);
54
bool
deleteTrimCurve
(
int
numberOfCurvesToDelete,
int
*curvesToDelete);
55
bool
undoLastDelete
();
56
57
intArray
projectedMask
;
// mask from mapGrid
58
TMquadRoot
*
quadTreeMesh
;
59
static
real
defaultFarthestDistanceNearCurve
;
60
real
farthestDistanceNearCurve
;
61
62
realArray
distanceToBoundary
;
// set by the map function
63
real
rBound
[3][2];
// *note* [axis][side]
64
65
protected
:
66
real
smallestLengthScale
;
// Estimate of the smallest length scale in the trimming curves.
67
real
dRmin
,
dSmin
;
// Smallest bounding boxes of any interior trimming curves. Used to set # lines
68
69
bool
upToDate
;
70
bool
validTrimming
;
71
bool
allNurbs
;
72
real
*
trimmingCurveArcLength
;
73
74
public
:
75
76
TrimmedMapping
();
77
#ifdef OLDSTUFF
78
TrimmedMapping
(
Mapping
&
surface
,
79
Mapping
*
outerCurve
=
NULL
,
80
const
int
&
numberOfInnerCurves
=0,
81
Mapping
**
innerCurve
=
NULL
);
82
#else
83
TrimmedMapping
(
Mapping
&
surface
,
84
Mapping
*
outerCurve
=
NULL
,
85
const
int
&
numberOfInnerCurves
=0,
86
Mapping
**
innerCurve
=
NULL
);
87
TrimmedMapping
(
Mapping
&
surface
,
88
const
int
& numberOfTrimCurves_=0,
89
Mapping
**trimCurves_=
NULL
);
90
#endif
91
92
// Copy constructor is deep by default
93
TrimmedMapping
(
const
TrimmedMapping
&,
const
CopyType
copyType=
DEEP
);
94
95
~TrimmedMapping
();
96
97
TrimmedMapping
&
operator =
(
const
TrimmedMapping
& X0 );
98
99
#ifdef OLDSTUFF
100
int
setCurves
(
Mapping
& surface_,
101
Mapping
*outerCurve_ =
NULL
,
102
const
int
& numberOfInnerCurves_ =0,
103
Mapping
**innerCurve_ =
NULL
);
104
#else
105
int
setCurves
(
Mapping
& surface_,
106
const
int
& numberOfTrimCurves_=0,
107
Mapping
**trimCurves=
NULL
);
108
#endif
109
110
void
map
(
const
realArray
&
r
,
realArray
& x,
realArray
& xr =
Overture::nullRealDistributedArray
(),
111
MappingParameters
& params =
Overture::nullMappingParameters
() );
112
113
// map a grid of points: r(0:n1,1), or r(0:n1,0:n2,2) or r((0:n1,0:n2,0:n3,3) for 1, 2 or 3d
114
virtual
void
mapGrid
(
const
realArray
& r,
115
realArray
& x,
116
realArray
& xr,
117
MappingParameters
& params=
Overture::nullMappingParameters
() );
118
119
virtual
void
basicInverse
(
const
realArray
& x,
120
realArray
& r,
121
realArray
& rx =
Overture::nullRealDistributedArray
(),
122
MappingParameters
& params =
Overture::nullMappingParameters
());
123
124
virtual
const
realArray
&
getGrid
(
MappingParameters
& params=
Overture::nullMappingParameters
(),
125
bool
includeGhost=
false
);
126
127
// If boundary curves are made of sub-curves then return the total of all sub-curves
128
int
getNumberOfBoundarySubCurves
();
129
130
#ifdef OLDSTUFF
131
int
getNumberOfInnerCurves
();
132
int
getNumberOfBoundaryCurves
();
133
#else
134
int
getNumberOfTrimCurves();
135
#endif
136
137
#ifdef OLDSTUFF
138
// access functions for the outer curve and inner curves
139
Mapping
*
getOuterCurve
();
140
Mapping
*
getInnerCurve
(
const
int
& curveNumber);
141
142
#else
143
Mapping
*
getOuterCurve
();
144
Mapping
*
getInnerCurve
(
const
int
& curveNumber);
145
Mapping
* getTrimCurve(
const
int
& curveNumber);
146
#endif
147
148
bool
hasTriangulation
()
const
;
// return true if there is a triangulation computed
149
150
UnstructuredMapping
&
getTriangulation
();
151
152
virtual
int
get
(
const
GenericDataBase
& dir,
const
aString
& name);
// get from a database file
153
virtual
int
put
(
GenericDataBase
& dir,
const
aString
& name)
const
;
// put to a database file
154
155
Mapping
*
make
(
const
aString
&
mappingClassName
);
156
aString
getClassName
()
const
{
return
TrimmedMapping::className
; }
157
158
int
update
(
MappingInformation
& mapInfo ) ;
159
int
editTrimCurve
(
Mapping
&trimCurve,
MappingInformation
& mapInfo ) ;
160
int
editNurbsTrimCurve
(
NurbsMapping
&trimCurve,
MappingInformation
& mapInfo ) ;
161
162
// return a pointer to the untrimmed surface
163
Mapping
*
untrimmedSurface
()
const
{
return
surface
;}
164
165
void
triangulate
(
MappingInformation
& mapInfo);
// interactive interface to triangulate.
166
void
triangulate
();
167
168
bool
isAllNurbs
()
const
{
return
allNurbs
; }
169
170
public
:
// protected:// ************************************************
171
172
int
setup
();
173
174
// initialize and optionally build the quadtree
175
void
initializeQuadTree
(
bool
buildQuadTree=
true
);
176
// void initialize();
177
// void createTrimmedSurface();
178
179
int
destroy
();
180
181
int
findClosestCurve
(
const
realArray
& x,
182
intArray & cMin,
183
realArray
& rC,
184
realArray
& xC,
185
realArray
& dist,
186
const
int
& approximate =
true
);
187
188
int
findDistanceToACurve
(
const
realArray
& x,
189
IntegerArray
& cMin,
190
realArray
& dist,
191
const
real
& delta );
192
int
insideOrOutside
(
const
realArray
& rr,
const
int
& c );
193
int
insideOrOutside
(
const
realArray
& rr,
const
int
& c,
realArray
& distance );
194
195
bool
curveGoesThrough
(
const
TMquad
& square,
const
int
& c,
int
& segstart,
int
& segstop )
196
const
;
197
bool
curveGoesThrough
(
const
TMquad
& square,
const
int
& c )
const
;
198
void
setBounds
(
bool
assignBoundsFromTriangulation =
true
);
199
200
// These next three functions control the triangulation
201
int
setMaxAreaForTriangulation
(
real
area=.1 );
202
int
setMinAngleForTriangulation
(
real
minAngle=20. );
203
int
setElementDensityToleranceForTriangulation
(
real
elementDensity=.05 );
204
205
int
getTriangulationParameters
(
real
&area,
real
&minAngle,
real
&elementDensity )
const
;
206
207
int
snapCurvesToIntersection
(
GenericGraphicsInterface
& gi,
NurbsMapping
& trimCurve,
208
int
&curve1,
int
&curve2,
int
curve1End,
int
curve2End,
209
const
real
*xSelect,
const
real
*c1click );
210
211
enum
MouseSelectMode
{
nothing
=0,
212
hideCurve
,
213
lineSegmentJoin
,
214
endpointMove
,
215
intersection
,
// snap to intersection
216
split
,
217
splitAtIntersection
,
218
translate
,
219
updateCurve
,
220
curveAssembly
,
221
numberOfMouseModes
};
222
223
int
assembleSubCurves
(
int
& currentCurve,
224
GenericGraphicsInterface
& gi,
225
NurbsMapping
& trimCurve,
226
NurbsMapping
& newCurve,
227
int
& numberOfAssembledCurves,
228
NurbsMapping
** & assemblyCurves,
229
MouseSelectMode
& mouseMode,
230
bool
& curveRebuilt,
231
bool
& plotCurve );
232
233
realArray
*
rCurve
;
234
235
real
timeForInsideOrOutside
;
236
real
timeForFindClosestCurve
;
237
real
timeForCreateTrimmedSurface
;
238
real
timeForFindDistanceToACurve
;
239
real
timeForMapGrid
;
240
real
timeForSeg0
;
// jfp debug
241
real
timeForSeg1
;
// jfp debug
242
real
timeForUntrimmedInverse
;
// jfp debug
243
int
callsOfFindClosestCurve
;
// jfp debug
244
int
callsOfFindClosestCurve_all
;
// jfp debug
245
246
UnstructuredMapping
*
triangulation
;
247
real
minAngleForTriangulation
;
// use this to reduce allowable angle to we don't get too many triangles: -1=default
248
real
elementDensityTolerance
;
// -1 = use default
249
real
maxArea
;
// approximate maximum area for triangles, 0=use default
250
251
static
real
defaultMinAngleForTriangulation
;
252
static
real
defaultElementDensityToleranceForTriangulation
;
// num grid pts based on curvature/(this value)
253
static
real
defaultMaximumAreaForTriangulation
;
// 0=no max area
254
255
private
:
256
Mapping
**oldTrimmingCurves;
257
int
numberOfOldTrimmingCurves;
258
intArray oldTrimOrientations;
259
//
260
// Virtual member functions used only through class ReferenceCounting:
261
//
262
virtual
ReferenceCounting
&
operator=
(
const
ReferenceCounting
& x)
263
{
return
operator=
((
TrimmedMapping
&)x); }
264
virtual
void
reference(
const
ReferenceCounting
& x)
265
{ reference((
TrimmedMapping
&)x); }
// *** Conversion to this class for the virtual = ****
266
virtual
ReferenceCounting
* virtualConstructor(
const
CopyType
ct =
DEEP
)
const
267
{ return ::new
TrimmedMapping
(*
this
, ct); }
268
269
};
270
271
#endif
Generated on Fri Jan 4 2013 10:18:00 for Overture by
1.8.3