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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
300a4d82
Commit
300a4d82
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
trying to fix compile on sun
parent
6dca266d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Numeric/cartesian.cpp
+4
-3
4 additions, 3 deletions
Numeric/cartesian.cpp
Numeric/cartesian.h
+49
-53
49 additions, 53 deletions
Numeric/cartesian.h
with
53 additions
and
56 deletions
Numeric/cartesian.cpp
+
4
−
3
View file @
300a4d82
...
...
@@ -12,7 +12,8 @@ public:
};
template
<
>
double
cartesianBox
<
double
>::
distance
(
double
x
,
double
y
,
double
z
)
const
{
double
cartesianBox
<
double
>::
distance
(
double
x
,
double
y
,
double
z
)
const
{
if
(
!
_ann
){
_ann
=
new
hiddenANN
;
_ann
->
index
=
new
ANNidx
[
2
];
...
...
@@ -43,9 +44,9 @@ double cartesianBox<double>::distance (double x, double y, double z) const{
}
#else
template
<
>
double
cartesianBox
<
double
>::
distance
(
double
x
,
double
y
,
double
z
)
const
{
double
cartesianBox
<
double
>::
distance
(
double
x
,
double
y
,
double
z
)
const
{
printf
(
"youpiiie
\n
"
);
return
0.0
;
}
#endif
This diff is collapsed.
Click to expand it.
Numeric/cartesian.h
+
49
−
53
View file @
300a4d82
...
...
@@ -7,9 +7,9 @@
#include
<stdio.h>
#include
"SVector3.h"
#include
"SPoint3.h"
// this is a cartesian mesh that encompasses
// an oriented box with _NX
x _NY x _NZ hexaderal
// cells
//
this is a cartesian mesh that encompasses
an oriented box with _NX
//
x _NY x _NZ hexaderal
cells
/* j
+---+---+---+---+---+---+
...
...
@@ -21,7 +21,6 @@
cell ij -> nodes i;j , i+i;j , i+1;j+1, i;j+1
active = CELLS : store i+N*j
*/
class
hiddenANN
;
...
...
@@ -29,26 +28,23 @@ class hiddenANN;
template
<
class
scalar
>
class
cartesianBox
{
mutable
hiddenANN
*
_ann
;
public:
typedef
int
INDEXTYPE
;
private:
private:
int
_Nxi
,
_Neta
,
_Nzeta
;
std
::
set
<
INDEXTYPE
>
_active
;
double
_X
,
_Y
,
_Z
,
_dxi
,
_deta
,
_dzeta
;
SVector3
_xiAxis
,
_etaAxis
,
_zetaAxis
;
std
::
map
<
INDEXTYPE
,
scalar
>
_nodal
_v
alues
;
std
::
set
<
int
>
_active
;
double
_X
,
_Y
,
_Z
,
_dxi
,
_deta
,
_dzeta
;
SVector3
_xiAxis
,
_etaAxis
,
_zetaAxis
;
std
::
map
<
int
,
scalar
>
_nodal
V
alues
;
std
::
vector
<
SVector3
>
_normals
;
std
::
vector
<
SPoint3
>
_points
;
public:
std
::
vector
<
SPoint3
>
&
points
()
{
return
_points
;}
std
::
vector
<
SVector3
>
&
normals
()
{
return
_normals
;}
std
::
vector
<
SPoint3
>
&
points
()
{
return
_points
;
}
std
::
vector
<
SVector3
>
&
normals
()
{
return
_normals
;
}
cartesianBox
(
double
X
,
double
Y
,
double
Z
,
const
SVector3
&
DXI
,
const
SVector3
&
DETA
,
const
SVector3
&
DZETA
,
int
NXI
,
int
NETA
,
int
NZETA
)
:
_ann
(
0
),
_X
(
X
),
_Y
(
Y
),
_Z
(
Z
),
:
_ann
(
0
),
_X
(
X
),
_Y
(
Y
),
_Z
(
Z
),
_dxi
(
norm
(
DXI
)),
_deta
(
norm
(
DETA
)),
_dzeta
(
norm
(
DZETA
)),
...
...
@@ -62,22 +58,23 @@ private:
_zetaAxis
.
normalize
();
}
typename
std
::
map
<
INDEXTYPE
,
scalar
>::
const_iterator
begin
()
const
{
return
_nodal
_v
alues
.
begin
();}
typename
std
::
map
<
INDEXTYPE
,
scalar
>::
const_iterator
end
()
const
{
return
_nodal
_v
alues
.
end
();}
typename
std
::
map
<
int
,
scalar
>::
const_iterator
begin
()
const
{
return
_nodal
V
alues
.
begin
();
}
typename
std
::
map
<
int
,
scalar
>::
const_iterator
end
()
const
{
return
_nodal
V
alues
.
end
();
}
// add that in the ann search tool
void
insert_point
(
double
x
,
double
y
,
double
z
){
void
insert_point
(
double
x
,
double
y
,
double
z
)
{
_points
.
push_back
(
SPoint3
(
x
,
y
,
z
));
}
// compute distance
double
distance
(
double
x
,
double
y
,
double
z
)
const
;
// set the value
void
setValue
(
INDEXTYPE
i
,
scalar
s
){
_nodal_values
[
i
]
=
s
;
void
setValue
(
int
i
,
scalar
s
)
{
_nodalValues
[
i
]
=
s
;
}
inline
INDEXTYPE
index_of_element
(
double
x
,
double
y
,
double
z
)
const
{
inline
int
index_of_element
(
double
x
,
double
y
,
double
z
)
const
{
// P = P_0 + xi * _vdx + eta * _vdy + zeta *vdz
// DP = P-P_0 * _vdx = xi
SVector3
DP
(
x
-
_X
,
y
-
_Y
,
z
-
_Z
);
...
...
@@ -96,12 +93,12 @@ private:
return
element_index
(
i
,
j
,
k
);
}
inline
SPoint3
coordinates_of_node
(
const
int
&
t
)
const
{
int
i
,
j
,
k
;
node_ijk
(
t
,
i
,
j
,
k
);
inline
SPoint3
coordinates_of_node
(
const
INDEXTYPE
&
t
)
const
{
int
i
,
j
,
k
;
node_ijk
(
t
,
i
,
j
,
k
);
// SVector3 DP (x-_X,y-_Y,z-_Z);
// SVector3 DP (x-_X,y-_Y,z-_Z);
const
double
xi
=
i
*
_dxi
/
_Nxi
;
const
double
eta
=
j
*
_deta
/
_Neta
;
...
...
@@ -114,50 +111,51 @@ private:
return
SPoint3
(
_X
+
D
.
x
(),
_Y
+
D
.
y
(),
_Z
+
D
.
z
());
}
void
insert
(
const
INDEXTYPE
&
t
)
{
void
insert
(
const
int
&
t
)
{
_active
.
insert
(
t
);
}
inline
INDEXTYPE
element_index
(
int
i
,
int
j
,
int
k
)
const
{
inline
int
element_index
(
int
i
,
int
j
,
int
k
)
const
{
return
i
+
_Nxi
*
j
+
_Nxi
*
_Neta
*
k
;
}
inline
INDEXTYPE
node_index
(
int
i
,
int
j
,
int
k
)
const
{
inline
int
node_index
(
int
i
,
int
j
,
int
k
)
const
{
return
i
+
(
_Nxi
+
1
)
*
j
+
(
_Nxi
+
1
)
*
(
_Neta
+
1
)
*
k
;
}
inline
void
element_ijk
(
INDEXTYPE
index
,
int
&
i
,
int
&
j
,
int
&
k
)
const
{
inline
void
element_ijk
(
int
index
,
int
&
i
,
int
&
j
,
int
&
k
)
const
{
k
=
index
/
(
_Nxi
*
_Neta
);
j
=
(
index
-
k
*
(
_Nxi
*
_Neta
))
/
_Nxi
;
i
=
(
index
-
k
*
(
_Nxi
*
_Neta
)
-
j
*
_Nxi
);
}
inline
void
node_ijk
(
INDEXTYPE
index
,
int
&
i
,
int
&
j
,
int
&
k
)
const
{
inline
void
node_ijk
(
int
index
,
int
&
i
,
int
&
j
,
int
&
k
)
const
{
k
=
index
/
((
_Nxi
+
1
)
*
(
_Neta
+
1
));
j
=
(
index
-
k
*
((
_Nxi
+
1
)
*
(
_Neta
+
1
)))
/
(
_Nxi
+
1
);
i
=
(
index
-
k
*
((
_Nxi
+
1
)
*
(
_Neta
+
1
))
-
j
*
(
_Nxi
+
1
));
}
inline
void
create_nodes
(){
std
::
set
<
INDEXTYPE
>::
const_iterator
it
=
_active
.
begin
();
inline
void
create_nodes
()
{
std
::
set
<
int
>::
const_iterator
it
=
_active
.
begin
();
for
(
;
it
!=
_active
.
end
()
;
++
it
){
const
INDEXTYPE
&
t
=
*
it
;
const
int
&
t
=
*
it
;
int
i
,
j
,
k
;
element_ijk
(
t
,
i
,
j
,
k
);
for
(
int
I
=
0
;
I
<
2
;
I
++
)
for
(
int
J
=
0
;
J
<
2
;
J
++
)
for
(
int
K
=
0
;
K
<
2
;
K
++
)
_nodal
_v
alues
[
node_index
(
i
+
I
,
j
+
J
,
k
+
K
)]
=
0.0
;
_nodal
V
alues
[
node_index
(
i
+
I
,
j
+
J
,
k
+
K
)]
=
0.0
;
}
}
void
writeMSH
(
const
std
::
string
&
filename
)
const
{
void
writeMSH
(
const
std
::
string
&
filename
)
const
{
FILE
*
f
=
fopen
(
filename
.
c_str
(),
"w"
);
fprintf
(
f
,
"$MeshFormat
\n
2.1 0 8
\n
$EndMeshFormat
\n
"
);
{
fprintf
(
f
,
"$Nodes
\n
%d
\n
"
,
_nodal
_v
alues
.
size
());
typename
std
::
map
<
INDEXTYPE
,
scalar
>::
const_iterator
it
=
_nodal
_v
alues
.
begin
();
for
(
;
it
!=
_nodal
_v
alues
.
end
();
++
it
){
fprintf
(
f
,
"$Nodes
\n
%d
\n
"
,
_nodal
V
alues
.
size
());
typename
std
::
map
<
int
,
scalar
>::
const_iterator
it
=
_nodal
V
alues
.
begin
();
for
(
;
it
!=
_nodal
V
alues
.
end
();
++
it
){
SPoint3
p
=
coordinates_of_node
(
it
->
first
);
fprintf
(
f
,
"%d %g %g %g
\n
"
,
it
->
first
,
p
.
x
(),
p
.
y
(),
p
.
z
());
}
...
...
@@ -165,7 +163,7 @@ private:
}
{
fprintf
(
f
,
"$Elements
\n
%d
\n
"
,
_active
.
size
());
std
::
set
<
INDEXTYPE
>::
const_iterator
it
=
_active
.
begin
();
std
::
set
<
int
>::
const_iterator
it
=
_active
.
begin
();
for
(
;
it
!=
_active
.
end
();
++
it
){
fprintf
(
f
,
"%d 5 3 1 1 1"
,
*
it
);
int
i
,
j
,
k
;
...
...
@@ -183,9 +181,9 @@ private:
fprintf
(
f
,
"$EndElements
\n
"
);
}
{
fprintf
(
f
,
"$NodeData
\n
1
\n\"
distance
\"\n
1
\n
0.0
\n
3
\n
0
\n
1
\n
%d
\n
"
,
_nodal
_v
alues
.
size
());
typename
std
::
map
<
INDEXTYPE
,
scalar
>::
const_iterator
it
=
_nodal
_v
alues
.
begin
();
for
(
;
it
!=
_nodal
_v
alues
.
end
();
++
it
){
fprintf
(
f
,
"$NodeData
\n
1
\n\"
distance
\"\n
1
\n
0.0
\n
3
\n
0
\n
1
\n
%d
\n
"
,
_nodal
V
alues
.
size
());
typename
std
::
map
<
int
,
scalar
>::
const_iterator
it
=
_nodal
V
alues
.
begin
();
for
(
;
it
!=
_nodal
V
alues
.
end
();
++
it
){
SPoint3
p
=
coordinates_of_node
(
it
->
first
);
// fprintf(f,"%d %g\n",it->first,distance(p.x(),p.y(),p.z()));
fprintf
(
f
,
"%d %g
\n
"
,
it
->
first
,
it
->
second
);
...
...
@@ -194,8 +192,6 @@ private:
}
fclose
(
f
);
}
};
#endif
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