Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
ccbe2f5c
Commit
ccbe2f5c
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
add option to store node coords for ruth
parent
0289fc4d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Post/shapeFunctions.h
+99
-65
99 additions, 65 deletions
Post/shapeFunctions.h
with
99 additions
and
65 deletions
Post/shapeFunctions.h
+
99
−
65
View file @
ccbe2f5c
...
...
@@ -13,13 +13,45 @@
class
element
{
protected:
bool
_ownData
;
double
*
_x
,
*
_y
,
*
_z
;
static
double
ONE
,
ZERO
;
public:
element
(
double
*
x
,
double
*
y
,
double
*
z
)
:
_x
(
x
),
_y
(
y
),
_z
(
z
)
{}
element
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
{
if
(
!
numNodes
){
_ownData
=
false
;
_x
=
x
;
_y
=
y
;
_z
=
z
;
}
else
{
_ownData
=
true
;
_x
=
new
double
[
numNodes
];
_y
=
new
double
[
numNodes
];
_z
=
new
double
[
numNodes
];
for
(
int
i
=
0
;
i
<
numNodes
;
i
++
){
_x
[
i
]
=
x
[
i
];
_y
[
i
]
=
y
[
i
];
_z
[
i
]
=
z
[
i
];
}
}
}
virtual
~
element
()
{
if
(
_ownData
){
delete
[]
_x
;
delete
[]
_y
;
delete
[]
_z
;
}
}
virtual
void
getXYZ
(
int
num
,
double
&
x
,
double
&
y
,
double
&
z
)
{
if
(
num
<
0
||
num
>=
getNumNodes
())
return
;
x
=
_x
[
num
];
y
=
_y
[
num
];
z
=
_z
[
num
];
}
static
void
setTolerance
(
const
double
tol
){
ONE
=
1.
+
tol
;
ZERO
=
-
tol
;
}
static
double
getTolerance
()
{
return
-
ZERO
;
}
virtual
~
element
(){}
virtual
int
getDimension
()
=
0
;
virtual
int
getNumNodes
()
=
0
;
virtual
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
=
0
;
...
...
@@ -238,7 +270,7 @@ public:
class
point
:
public
element
{
public:
point
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
point
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
0
;
}
inline
int
getNumNodes
(){
return
1
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -279,7 +311,7 @@ public:
class
line
:
public
element
{
public:
line
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
line
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
1
;
}
inline
int
getNumNodes
(){
return
2
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -340,7 +372,7 @@ public:
class
triangle
:
public
element
{
public:
triangle
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
triangle
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
2
;
}
inline
int
getNumNodes
(){
return
3
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -431,7 +463,7 @@ public:
class
quadrangle
:
public
element
{
public:
quadrangle
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
quadrangle
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
2
;
}
inline
int
getNumNodes
(){
return
4
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -512,7 +544,7 @@ public:
class
tetrahedron
:
public
element
{
public:
tetrahedron
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
tetrahedron
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
3
;
}
inline
int
getNumNodes
(){
return
4
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -599,7 +631,7 @@ public:
class
hexahedron
:
public
element
{
public:
hexahedron
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
hexahedron
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
3
;
}
inline
int
getNumNodes
(){
return
8
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -706,7 +738,7 @@ public:
class
prism
:
public
element
{
public:
prism
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
prism
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
3
;
}
inline
int
getNumNodes
(){
return
6
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -800,7 +832,7 @@ public:
class
pyramid
:
public
element
{
public:
pyramid
(
double
*
x
,
double
*
y
,
double
*
z
)
:
element
(
x
,
y
,
z
)
{}
pyramid
(
double
*
x
,
double
*
y
,
double
*
z
,
int
numNodes
=
0
)
:
element
(
x
,
y
,
z
,
numNodes
)
{}
inline
int
getDimension
(){
return
3
;
}
inline
int
getNumNodes
(){
return
5
;
}
void
getNode
(
int
num
,
double
&
u
,
double
&
v
,
double
&
w
)
...
...
@@ -923,18 +955,20 @@ public:
class
elementFactory
{
public:
element
*
create
(
int
numNodes
,
int
dimension
,
double
*
x
,
double
*
y
,
double
*
z
){
element
*
create
(
int
numNodes
,
int
dimension
,
double
*
x
,
double
*
y
,
double
*
z
,
bool
copy
=
false
)
{
switch
(
dimension
){
case
0
:
return
new
point
(
x
,
y
,
z
);
case
1
:
return
new
line
(
x
,
y
,
z
);
case
0
:
return
new
point
(
x
,
y
,
z
,
copy
?
numNodes
:
0
);
case
1
:
return
new
line
(
x
,
y
,
z
,
copy
?
numNodes
:
0
);
case
2
:
if
(
numNodes
==
4
)
return
new
quadrangle
(
x
,
y
,
z
);
else
return
new
triangle
(
x
,
y
,
z
);
if
(
numNodes
==
4
)
return
new
quadrangle
(
x
,
y
,
z
,
copy
?
numNodes
:
0
);
else
return
new
triangle
(
x
,
y
,
z
,
copy
);
case
3
:
if
(
numNodes
==
8
)
return
new
hexahedron
(
x
,
y
,
z
);
else
if
(
numNodes
==
6
)
return
new
prism
(
x
,
y
,
z
);
else
if
(
numNodes
==
5
)
return
new
pyramid
(
x
,
y
,
z
);
else
return
new
tetrahedron
(
x
,
y
,
z
);
if
(
numNodes
==
8
)
return
new
hexahedron
(
x
,
y
,
z
,
copy
?
numNodes
:
0
);
else
if
(
numNodes
==
6
)
return
new
prism
(
x
,
y
,
z
,
copy
?
numNodes
:
0
);
else
if
(
numNodes
==
5
)
return
new
pyramid
(
x
,
y
,
z
,
copy
?
numNodes
:
0
);
else
return
new
tetrahedron
(
x
,
y
,
z
,
copy
?
numNodes
:
0
);
default:
Msg
::
Error
(
"Unknown type of element in factory"
);
return
NULL
;
...
...
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