Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VirtualFluids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iRMB
VirtualFluids
Commits
b03f1ae5
Commit
b03f1ae5
authored
6 years ago
by
Soeren Peters
Browse files
Options
Downloads
Patches
Plain Diff
change gbtrifacemesh to DC-Steering
parent
04b0d0c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.h
+41
-55
41 additions, 55 deletions
...VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.h
with
41 additions
and
55 deletions
src/VirtualFluidsBasics/numerics/geometry3d/GbTriFaceMesh3D.h
+
41
−
55
View file @
b03f1ae5
...
...
@@ -18,17 +18,12 @@
#include
<basics/utilities/UbException.h>
#include
<basics/utilities/UbMath.h>
#include
<basics/utilities/Vector3D.h>
#include
<basics/writer/WbWriter.h>
#include
<basics/memory/MbSmartPtr.h>
#include
<numerics/geometry3d/GbPoint3D.h>
#include
<basics/memory/MbSharedPointerDefines.h>
class
GbTriFaceMesh3D
;
typedef
VFSharedPtr
<
GbTriFaceMesh3D
>
GbTriFaceMesh3DPtr
;
#include
<numerics/geometry3d/GbPoint3D.h>
#include
"basics/utilities/Vector3D.h"
namespace
Kd
{
...
...
@@ -37,6 +32,9 @@ namespace Kd
template
<
typename
T
>
class
RayIntersectionHandler
;
}
//RayCrossing Test ...
//http://orion.math.iastate.edu/burkardt/c_src/orourke/inhedron.c
/*=========================================================================*/
/* GbTriFaceMesh3D */
...
...
@@ -79,7 +77,7 @@ public:
}
bool
operator
==
(
const
Vertex
&
rhs
)
{
return
(
fabs
(
x
-
rhs
.
x
)
<
1.E-
8
&&
fabs
(
y
-
rhs
.
y
)
<
1.E-
8
&&
fabs
(
z
-
rhs
.
z
)
<
1.E-
8
);
return
(
fabs
(
x
-
rhs
.
x
)
<
1.E-
10
&&
fabs
(
y
-
rhs
.
y
)
<
1.E-
10
&&
fabs
(
z
-
rhs
.
z
)
<
1.E-
10
);
}
friend
inline
bool
operator
<
(
const
Vertex
&
lhsVert
,
const
Vertex
&
rhsVert
)
{
...
...
@@ -100,6 +98,12 @@ public:
return
(
new
Vertex
(
this
));
}
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
ar
&
x
&
y
&
z
;
}
#ifdef CAB_RCF
template
<
class
Archive
>
void
SF_SERIALIZE
(
Archive
&
ar
)
...
...
@@ -220,6 +224,13 @@ public:
<<
"->removeRedunantNodes"
<<
std
::
endl
;
}
}
template
<
class
Archive
>
void
serialize
(
Archive
&
ar
,
const
unsigned
int
version
)
{
ar
&
v1
&
v2
&
v3
;
}
#ifdef CAB_RCF
template
<
class
Archive
>
void
SF_SERIALIZE
(
Archive
&
ar
)
...
...
@@ -234,14 +245,14 @@ public:
};
public
:
enum
KDTREE_SPLITAGORITHM
{
KDTREE_S
A
HPLIT
,
KDTREE_SPATIALSPLIT
};
enum
KDTREE_SPLITAGORITHM
{
KDTREE_SH
A
PLIT
,
KDTREE_SPATIALSPLIT
};
public
:
GbTriFaceMesh3D
();
GbTriFaceMesh3D
(
std
::
string
name
,
std
::
vector
<
Vertex
>*
nodes
,
std
::
vector
<
TriFace
>*
triangles
,
KDTREE_SPLITAGORITHM
splitAlg
=
KDTREE_S
A
HPLIT
,
bool
removeRedundantNodes
=
true
);
GbTriFaceMesh3D
(
std
::
string
name
,
std
::
vector
<
Vertex
>*
nodes
,
std
::
vector
<
TriFace
>*
triangles
,
KDTREE_SPLITAGORITHM
splitAlg
=
KDTREE_SH
A
PLIT
,
bool
removeRedundantNodes
=
true
);
~
GbTriFaceMesh3D
();
GbTriFaceMesh3D
*
clone
()
;
//
{ throw UbException(UB_EXARGS,"not implemented"); }
GbTriFaceMesh3D
*
clone
()
{
throw
UbException
(
UB_EXARGS
,
"not implemented"
);
}
void
finalize
()
{}
//void setRegardPointInPolyhedronTest(bool value) { this->regardPiO=value; }
...
...
@@ -251,16 +262,6 @@ public:
//std::string getName();
std
::
vector
<
Vertex
>*
getNodes
();
std
::
vector
<
TriFace
>*
getTriangles
();
void
setTransferViaFilename
(
bool
transferViaFilename
,
std
::
string
filename
,
double
transX1
,
double
transX2
,
double
transX3
)
{
this
->
filename
=
filename
;
this
->
transferViaFilename
=
transferViaFilename
;
this
->
transX1
=
transX1
;
this
->
transX2
=
transX2
;
this
->
transX3
=
transX3
;
}
void
readMeshFromSTLFile
(
std
::
string
filename
,
bool
removeRedundantNodes
);
double
getX1Minimum
()
{
if
(
!
this
->
consistent
)
this
->
calculateValues
();
return
this
->
x1min
;
}
double
getX1Maximum
()
{
if
(
!
this
->
consistent
)
this
->
calculateValues
();
return
this
->
x1max
;
}
...
...
@@ -275,6 +276,7 @@ public:
double
getX3Maximum
()
{
if
(
!
this
->
consistent
)
this
->
calculateValues
();
return
this
->
x3max
;
}
void
calculateValues
();
void
generateKdTree
();
double
getVolume
();
void
deleteRedundantNodes
();
...
...
@@ -282,17 +284,13 @@ public:
UbTupleDouble6
calculateMomentOfInertia
(
double
rhoP
);
UbTupleDouble3
calculateCenterOfGravity
();
void
setCenterCoordinates
(
const
double
&
x1
,
const
double
&
x2
,
const
double
&
x3
);
void
scale
(
const
double
&
sx1
,
const
double
&
sx2
,
const
double
&
sx3
);
void
transform
(
const
double
matrix
[
4
][
4
]);
void
rotate
(
const
double
&
alpha
,
const
double
&
beta
,
const
double
&
gamma
);
void
rotateAroundPoint
(
const
double
&
p
x1
,
const
double
&
p
x2
,
const
double
&
p
x3
,
const
double
&
alpha
,
const
double
&
beta
,
const
double
&
gamma
);
void
scale
(
const
double
&
s
x1
,
const
double
&
s
x2
,
const
double
&
s
x3
);
void
translate
(
const
double
&
x1
,
const
double
&
x2
,
const
double
&
x3
);
void
reflectAcrossXYLine
(
const
double
&
alpha
);
bool
isPointInGbObject3D
(
const
double
&
x1
,
const
double
&
x2
,
const
double
&
x3
);
bool
isPointInGbObject3D
(
const
double
&
x1
,
const
double
&
x2
,
const
double
&
x3
,
int
counter
);
bool
isPointInGbObject3D
(
const
double
&
x1
,
const
double
&
x2
,
const
double
&
x3
,
bool
&
pointIsOnBoundary
);
virtual
GbLine3D
*
createClippedLine3D
(
GbPoint3D
&
point1
,
GbPoint3D
&
point2
);
...
...
@@ -302,7 +300,16 @@ public:
std
::
vector
<
GbTriFaceMesh3D
::
TriFace
*>
getTrianglesForVertex
(
Vertex
*
vertex
);
void
setKdTreeSplitAlgorithm
(
KDTREE_SPLITAGORITHM
mode
);
void
setKdTreeSplitAlgorithm
(
KDTREE_SPLITAGORITHM
mode
)
{
this
->
kdtreeSplitAlg
=
mode
;
bool
rebuild
=
(
mode
!=
kdtreeSplitAlg
);
if
(
(
rebuild
||
!
kdTree
)
&&
(
kdtreeSplitAlg
==
KDTREE_SHAPLIT
||
kdtreeSplitAlg
==
KDTREE_SPATIALSPLIT
)
)
{
this
->
calculateValues
();
}
}
KDTREE_SPLITAGORITHM
getKdTreeSplitAlgorithm
()
{
return
this
->
kdtreeSplitAlg
;
}
Kd
::
Tree
<
double
>*
getKdTree
()
{
return
this
->
kdTree
;
}
...
...
@@ -312,36 +319,20 @@ public:
void
read
(
UbFileInput
*
in
);
virtual
UbTuple
<
std
::
string
,
std
::
string
>
writeMesh
(
std
::
string
filename
,
WbWriter
*
writer
,
bool
writeNormals
=
false
,
std
::
vector
<
std
::
string
>*
datanames
=
NULL
,
std
::
vector
<
std
::
vector
<
double
>
>*
nodedata
=
NULL
);
void
writeMeshPly
(
const
std
::
string
&
filename
);
/*======================================================================*/
using
GbObject3D
::
isPointInGbObject3D
;
//Grund: dadurch muss man hier isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren, welche sonst hier "ueberdeckt" waere
bool
intersectLine
(
const
double
&
p1_x1
,
const
double
&
p1_x2
,
const
double
&
p1_x3
,
const
double
&
p2_x1
,
const
double
&
p2_x2
,
const
double
&
p2_x3
);
#ifdef CAB_RCF
template
<
class
Archive
>
void
SF_SERIALIZE
(
Archive
&
ar
)
{
SF_SERIALIZE_PARENT
<
GbObject3D
>
(
ar
,
*
this
);
ar
&
kdtreeSplitAlg
;
ar
&
transferViaFilename
;
if
(
!
transferViaFilename
)
{
ar
&
nodes
;
ar
&
triangles
;
}
else
{
ar
&
filename
;
ar
&
transX1
;
ar
&
transX2
;
ar
&
transX3
;
if
(
ArchiveTools
::
isReading
(
ar
)
)
{
this
->
readMeshFromSTLFile
(
filename
,
true
);
this
->
translate
(
transX1
,
transX2
,
transX3
);
}
}
ar
&
nodes
;
ar
&
triangles
;
if
(
ArchiveTools
::
isReading
(
ar
))
this
->
calculateValues
();
}
#endif //CAB_RCF
...
...
@@ -352,12 +343,6 @@ protected:
std
::
vector
<
Vertex
>*
nodes
;
std
::
vector
<
TriFace
>*
triangles
;
//for transfer
std
::
string
filename
;
bool
transferViaFilename
;
double
transX1
;
double
transX2
;
double
transX3
;
double
x1min
;
double
x1max
;
...
...
@@ -370,6 +355,7 @@ protected:
double
x3center
;
bool
consistent
;
bool
kdTreeValid
;
bool
buildVertTriRelationMap
;
std
::
multimap
<
Vertex
*
,
TriFace
*>
relationVertTris
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment