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
11bf3cd1
Commit
11bf3cd1
authored
14 years ago
by
Gregory Legrain
Browse files
Options
Downloads
Patches
Plain Diff
Added some methods :
* iterator on active cells * get the nodal values on a given cell
parent
45893655
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Numeric/cartesian.h
+91
-2
91 additions, 2 deletions
Numeric/cartesian.h
with
91 additions
and
2 deletions
Numeric/cartesian.h
+
91
−
2
View file @
11bf3cd1
...
@@ -61,6 +61,67 @@ class cartesianBox {
...
@@ -61,6 +61,67 @@ class cartesianBox {
typename
std
::
map
<
int
,
scalar
>::
const_iterator
begin
()
const
{
return
_nodalValues
.
begin
();
}
typename
std
::
map
<
int
,
scalar
>::
const_iterator
begin
()
const
{
return
_nodalValues
.
begin
();
}
typename
std
::
map
<
int
,
scalar
>::
const_iterator
end
()
const
{
return
_nodalValues
.
end
();
}
typename
std
::
map
<
int
,
scalar
>::
const_iterator
end
()
const
{
return
_nodalValues
.
end
();
}
typedef
std
::
set
<
int
>::
iterator
boxIter
;
boxIter
activeBoxBegin
()
{
return
_active
.
begin
();
}
boxIter
activeBoxEnd
()
{
return
_active
.
end
();
}
//Perhaps not optimal (lot of searches...)
void
getNodalValues
(
const
int
&
t
,
std
::
vector
<
scalar
>
&
ls_values
)
{
int
i
,
j
,
k
;
element_ijk
(
t
,
i
,
j
,
k
);
typename
std
::
map
<
int
,
scalar
>::
iterator
itNode
=
_nodalValues
.
find
(
node_index
(
i
,
j
,
k
));
ls_values
.
push_back
(
itNode
->
second
);
itNode
=
_nodalValues
.
find
(
node_index
(
i
+
1
,
j
,
k
));
ls_values
.
push_back
(
itNode
->
second
);
itNode
=
_nodalValues
.
find
(
node_index
(
i
+
1
,
j
+
1
,
k
));
ls_values
.
push_back
(
itNode
->
second
);
itNode
=
_nodalValues
.
find
(
node_index
(
i
,
j
+
1
,
k
));
ls_values
.
push_back
(
itNode
->
second
);
itNode
=
_nodalValues
.
find
(
node_index
(
i
,
j
,
k
+
1
));
ls_values
.
push_back
(
itNode
->
second
);
itNode
=
_nodalValues
.
find
(
node_index
(
i
+
1
,
j
,
k
+
1
));
ls_values
.
push_back
(
itNode
->
second
);
itNode
=
_nodalValues
.
find
(
node_index
(
i
+
1
,
j
+
1
,
k
+
1
));
ls_values
.
push_back
(
itNode
->
second
);
itNode
=
_nodalValues
.
find
(
node_index
(
i
,
j
+
1
,
k
+
1
));
ls_values
.
push_back
(
itNode
->
second
);
return
;
}
// // Test : does not work for the moment
// bool connectedToActiveCell(int i, int j, int k){
//
// int connectedCells[8]={-1,-1,-1,-1,-1,-1,-1,-1};
//
// connectedCells[0]=element_index(i,j,k);
// connectedCells[1]=element_index(i-1,j,k);
// connectedCells[2]=element_index(i,j-1,k);
// connectedCells[3]=element_index(i-1,j-1,k);
// connectedCells[4]=element_index(i,j,k-1);
// connectedCells[5]=element_index(i-1,j,k-1);
// connectedCells[6]=element_index(i,j-1,k-1);
// connectedCells[7]=element_index(i-1,j-1,k-1);
//
// bool activeCell=false;
//
// for(int I=0;I<8;++I){
// activeCell += (_active.find() == _active.end());
// }
//
// return activeCell;
//
// }
// add that in the ann search tool
// 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
)
{
{
...
@@ -115,6 +176,16 @@ class cartesianBox {
...
@@ -115,6 +176,16 @@ class cartesianBox {
{
{
_active
.
insert
(
t
);
_active
.
insert
(
t
);
}
}
void
erase
(
const
int
&
t
)
{
_active
.
erase
(
t
);
}
void
erase
(
std
::
set
<
int
>::
iterator
t
)
{
_active
.
erase
(
t
);
}
inline
int
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
;
return
i
+
_Nxi
*
j
+
_Nxi
*
_Neta
*
k
;
...
@@ -148,7 +219,7 @@ class cartesianBox {
...
@@ -148,7 +219,7 @@ class cartesianBox {
_nodalValues
[
node_index
(
i
+
I
,
j
+
J
,
k
+
K
)]
=
0.0
;
_nodalValues
[
node_index
(
i
+
I
,
j
+
J
,
k
+
K
)]
=
0.0
;
}
}
}
}
void
writeMSH
(
const
std
::
string
&
filename
,
bool
simplex
=
false
)
const
void
writeMSH
(
const
std
::
string
&
filename
,
bool
simplex
=
false
,
bool
writeLS
=
true
)
const
{
{
// const bool simplex=false;
// const bool simplex=false;
...
@@ -238,7 +309,7 @@ class cartesianBox {
...
@@ -238,7 +309,7 @@ class cartesianBox {
}
}
fprintf
(
f
,
"$EndElements
\n
"
);
fprintf
(
f
,
"$EndElements
\n
"
);
}
}
{
if
(
writeLS
)
{
fprintf
(
f
,
"$NodeData
\n
1
\n\"
distance
\"\n
1
\n
0.0
\n
3
\n
0
\n
1
\n
%d
\n
"
,
_nodalValues
.
size
());
fprintf
(
f
,
"$NodeData
\n
1
\n\"
distance
\"\n
1
\n
0.0
\n
3
\n
0
\n
1
\n
%d
\n
"
,
_nodalValues
.
size
());
typename
std
::
map
<
int
,
scalar
>::
const_iterator
it
=
_nodalValues
.
begin
();
typename
std
::
map
<
int
,
scalar
>::
const_iterator
it
=
_nodalValues
.
begin
();
for
(
;
it
!=
_nodalValues
.
end
();
++
it
){
for
(
;
it
!=
_nodalValues
.
end
();
++
it
){
...
@@ -250,6 +321,24 @@ class cartesianBox {
...
@@ -250,6 +321,24 @@ class cartesianBox {
}
}
fclose
(
f
);
fclose
(
f
);
}
}
void
writeLSOnly
(
const
std
::
string
&
filename
)
const
{
FILE
*
f
=
fopen
(
filename
.
c_str
(),
"w"
);
fprintf
(
f
,
"%d
\n
"
,
_nodalValues
.
size
());
typename
std
::
map
<
int
,
scalar
>::
const_iterator
it
=
_nodalValues
.
begin
();
for
(
;
it
!=
_nodalValues
.
end
();
++
it
){
SPoint3
p
=
coordinates_of_node
(
it
->
first
);
fprintf
(
f
,
"%d %g
\n
"
,
it
->
first
,
it
->
second
);
}
fclose
(
f
);
}
};
};
#endif
#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