Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
INMOST
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Terekhov
INMOST
Commits
e145375f
Commit
e145375f
authored
Jan 15, 2015
by
Kirill Terekhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #5
Adapting mesh_file.cpp to new comparator's behavior.
parent
c5f557ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
9 deletions
+75
-9
examples/Solver/main.cpp
examples/Solver/main.cpp
+13
-1
mesh.cpp
mesh.cpp
+19
-2
mesh_file.cpp
mesh_file.cpp
+43
-6
No files found.
examples/Solver/main.cpp
View file @
e145375f
...
...
@@ -146,11 +146,23 @@ Storage::real tensor_K_mat_rotOxy(Storage::integer mat)
int
main
(
int
argc
,
char
**
argv
)
{
Mesh
::
Initialize
(
&
argc
,
&
argv
);
Solver
::
Initialize
(
&
argc
,
&
argv
,
"database.txt"
);
#if defined(USE_PARTITIONER)
Partitioner
::
Initialize
(
&
argc
,
&
argv
);
#endif
{
Mesh
m
;
//m.SetFileOption("VERBOSITY","2");
m
.
Load
(
argv
[
1
]);
m
.
Save
(
"dump.pvtk"
);
}
Solver
::
Finalize
();
Partitioner
::
Finalize
();
Mesh
::
Finalize
();
return
0
;
if
(
argc
>
1
)
{
Tag
phi
,
tensor_K
,
id
,
mat
;
...
...
mesh.cpp
View file @
e145375f
...
...
@@ -372,8 +372,25 @@ namespace INMOST
#if defined(USE_MPI_P2P)
if
(
m_state
==
Mesh
::
Parallel
)
{
MPI_Free_mem
(
shared_space
);
MPI_Win_free
(
&
window
);
int
test
=
0
;
MPI_Finalized
(
&
test
);
if
(
!
test
)
{
MPI_Free_mem
(
shared_space
);
MPI_Win_free
(
&
window
);
}
else
{
std
::
cout
<<
"Cannot release memory and window allocated by MPI"
<<
std
::
endl
;
std
::
cout
<<
"since MPI was already finalized. Most likely this"
<<
std
::
endl
;
std
::
cout
<<
"happens when you define class Mesh in main() function"
<<
std
::
endl
;
std
::
cout
<<
"so that destructor get called after Mesh::Finalize()"
<<
std
::
endl
;
std
::
cout
<<
"Please enclose area where you use Mesh class"
<<
std
::
endl
;
std
::
cout
<<
"with scopes, so that destructor get called when"
<<
std
::
endl
;
std
::
cout
<<
"execution goes out of the scope or dynamically"
<<
std
::
endl
;
std
::
cout
<<
"allocate and explicitly delete Mesh class."
<<
std
::
endl
;
std
::
cout
<<
"Thank you!"
<<
std
::
endl
;
}
//~ MPI_Comm_free(&comm);
}
#endif //USE_MPI_P2P
...
...
mesh_file.cpp
View file @
e145375f
...
...
@@ -581,7 +581,12 @@ ecl_exit_loop:
if
(
!
old_nodes
.
empty
()
)
{
std
::
vector
<
HandleType
>::
iterator
it
=
std
::
lower_bound
(
old_nodes
.
begin
(),
old_nodes
.
end
(),
node_xyz
,
CentroidComparator
(
this
));
if
(
it
!=
old_nodes
.
end
()
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
if
(
it
!=
old_nodes
.
end
()
)
{
Storage
::
real_array
c
=
RealArrayDF
(
*
it
,
CoordsTag
());
if
(
CentroidComparator
(
this
).
Compare
(
node_xyz
,
c
.
data
())
==
0
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
}
}
if
(
find
==
-
1
)
newnodes
[
numnode
++
]
=
CreateNode
(
node_xyz
)
->
GetHandle
();
else
newnodes
[
numnode
++
]
=
old_nodes
[
find
];
...
...
@@ -793,7 +798,14 @@ ecl_exit_loop:
old_nodes
[
qq
++
]
=
*
it
;
}
if
(
!
old_nodes
.
empty
()
)
{
std
::
sort
(
old_nodes
.
begin
(),
old_nodes
.
end
(),
CentroidComparator
(
this
));
//for(std::vector<HandleType>::iterator it = old_nodes.begin(); it != old_nodes.end(); ++it)
//{
// Storage::real_array c = RealArrayDF(*it,CoordsTag());
// REPORT_VAL("coord: ",c[0] << " " << c[1] << " " << c[2]);
//}
}
FILE
*
f
=
fopen
(
File
.
c_str
(),
"r"
);
...
...
@@ -1335,7 +1347,12 @@ ecl_exit_loop:
if
(
!
old_nodes
.
empty
()
)
{
std
::
vector
<
HandleType
>::
iterator
it
=
std
::
lower_bound
(
old_nodes
.
begin
(),
old_nodes
.
end
(),
coords
,
CentroidComparator
(
this
));
if
(
it
!=
old_nodes
.
end
()
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
if
(
it
!=
old_nodes
.
end
()
)
{
Storage
::
real_array
c
=
RealArrayDF
(
*
it
,
CoordsTag
());
if
(
CentroidComparator
(
this
).
Compare
(
c
.
data
(),
coords
)
==
0
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
}
}
if
(
find
==
-
1
)
newnodes
[
i
]
=
CreateNode
(
coords
)
->
GetHandle
();
...
...
@@ -1365,7 +1382,12 @@ ecl_exit_loop:
if
(
!
old_nodes
.
empty
()
)
{
std
::
vector
<
HandleType
>::
iterator
it
=
std
::
lower_bound
(
old_nodes
.
begin
(),
old_nodes
.
end
(),
coords
,
CentroidComparator
(
this
));
if
(
it
!=
old_nodes
.
end
()
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
if
(
it
!=
old_nodes
.
end
()
)
{
Storage
::
real_array
c
=
RealArrayDF
(
*
it
,
CoordsTag
());
if
(
CentroidComparator
(
this
).
Compare
(
c
.
data
(),
coords
)
==
0
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
}
}
if
(
find
==
-
1
)
newnodes
[
i
]
=
CreateNode
(
coords
)
->
GetHandle
();
else
newnodes
[
i
]
=
old_nodes
[
find
];
...
...
@@ -2105,7 +2127,12 @@ ecl_exit_loop:
if
(
!
old_nodes
.
empty
()
)
{
std
::
vector
<
HandleType
>::
iterator
it
=
std
::
lower_bound
(
old_nodes
.
begin
(),
old_nodes
.
end
(),
xyz
,
CentroidComparator
(
this
));
if
(
it
!=
old_nodes
.
end
()
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
if
(
it
!=
old_nodes
.
end
()
)
{
Storage
::
real_array
c
=
RealArrayDF
(
*
it
,
CoordsTag
());
if
(
CentroidComparator
(
this
).
Compare
(
xyz
,
c
.
data
())
==
0
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
}
}
if
(
find
==
-
1
)
newnodes
[
i
]
=
CreateNode
(
xyz
)
->
GetHandle
();
else
newnodes
[
i
]
=
old_nodes
[
find
];
...
...
@@ -2471,7 +2498,12 @@ read_node_num_link:
if
(
!
old_nodes
.
empty
()
)
{
std
::
vector
<
HandleType
>::
iterator
it
=
std
::
lower_bound
(
old_nodes
.
begin
(),
old_nodes
.
end
(),
xyz
,
CentroidComparator
(
this
));
if
(
it
!=
old_nodes
.
end
()
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
if
(
it
!=
old_nodes
.
end
()
)
{
Storage
::
real_array
c
=
RealArrayDF
(
*
it
,
CoordsTag
());
if
(
CentroidComparator
(
this
).
Compare
(
xyz
,
c
.
data
())
==
0
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
}
}
if
(
find
==
-
1
)
newnodes
[
nodenum
]
=
CreateNode
(
xyz
)
->
GetHandle
();
else
newnodes
[
nodenum
]
=
old_nodes
[
find
];
...
...
@@ -3236,7 +3268,12 @@ read_elem_num_link:
if
(
!
old_nodes
.
empty
()
)
{
std
::
vector
<
HandleType
>::
iterator
it
=
std
::
lower_bound
(
old_nodes
.
begin
(),
old_nodes
.
end
(),
coords
,
CentroidComparator
(
this
));
if
(
it
!=
old_nodes
.
end
()
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
if
(
it
!=
old_nodes
.
end
()
)
{
Storage
::
real_array
c
=
RealArrayDF
(
*
it
,
CoordsTag
());
if
(
CentroidComparator
(
this
).
Compare
(
coords
,
c
.
data
())
==
0
)
find
=
static_cast
<
int
>
(
it
-
old_nodes
.
begin
());
}
}
if
(
find
==
-
1
)
new_nodes
[
i
]
=
CreateNode
(
coords
)
->
GetHandle
();
else
new_nodes
[
i
]
=
old_nodes
[
find
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment