Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Dmitri Naumov
ogs
Commits
12983f96
Commit
12983f96
authored
10 years ago
by
wenqing
Committed by
Dmitri Naumov
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[T] Simple test for node partitioned mesh reader.
parent
84b5e2e1
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
SimpleTests/MeshTests/CMakeLists.txt
+40
-0
40 additions, 0 deletions
SimpleTests/MeshTests/CMakeLists.txt
SimpleTests/MeshTests/NodePartitionedMeshTester.cpp
+105
-0
105 additions, 0 deletions
SimpleTests/MeshTests/NodePartitionedMeshTester.cpp
with
145 additions
and
0 deletions
SimpleTests/MeshTests/CMakeLists.txt
+
40
−
0
View file @
12983f96
...
@@ -47,3 +47,43 @@ TARGET_LINK_LIBRARIES ( MeshSearchTest
...
@@ -47,3 +47,43 @@ TARGET_LINK_LIBRARIES ( MeshSearchTest
${
ADDITIONAL_LIBS
}
${
ADDITIONAL_LIBS
}
${
BOOST_LIBRARIES
}
${
BOOST_LIBRARIES
}
)
)
#
# Node partitioned mesh reader and ctests
#
ADD_EXECUTABLE
(
test_node_partitioned_mesh
NodePartitionedMeshTester.cpp
)
TARGET_LINK_LIBRARIES
(
test_node_partitioned_mesh
MeshLib
FileIO
BaseLib
logog
${
ADDITIONAL_LIBS
}
${
BOOST_LIBRARIES
}
)
IF
(
OGS_USE_PETSC
)
TARGET_LINK_LIBRARIES
(
test_node_partitioned_mesh
${
PETSC_LIBRARIES
}
)
ENDIF
(
OGS_USE_PETSC
)
IF
(
OGS_USE_MPI
)
TARGET_LINK_LIBRARIES
(
test_node_partitioned_mesh
${
MPI_CXX_LIBRARIES
}
)
ENDIF
()
set
(
FilePath
"DATA{
${
ExternalData_SOURCE_ROOT
}
/NodePartitionedMesh/ASCII/,REGEX:.*}"
)
set
(
MPITestParameters -np 3
"
${
PROJECT_BINARY_DIR
}
/bin/test_node_partitioned_mesh"
"
${
FilePath
}
/mesh_3d"
)
ExternalData_Add_Test
(
data
NAME NodePartitionedMeshTestASCII
COMMAND
"mpirun"
${
MPITestParameters
}
)
set
(
FilePath
"DATA{
${
ExternalData_SOURCE_ROOT
}
/NodePartitionedMesh/Binary/,REGEX:.*}"
)
set
(
MPITestParameters -np 3
"
${
PROJECT_BINARY_DIR
}
/bin/test_node_partitioned_mesh"
"
${
FilePath
}
/mesh_3d"
)
ExternalData_Add_Test
(
data
NAME NodePartitionedMeshTestBinary
COMMAND
"mpirun"
${
MPITestParameters
}
)
This diff is collapsed.
Click to expand it.
SimpleTests/MeshTests/NodePartitionedMeshTester.cpp
0 → 100644
+
105
−
0
View file @
12983f96
/*!
\file NodePartitionedMeshTester.cpp
\author Wenqing Wang
\date 2014.11
\brief Test class readNodePartitionedMesh to read node-wise partitioned mesh with MPI functions.
\copyright
Copyright (c) 2012-2014, OpenGeoSys Community (http://www.opengeosys.org)
Distributed under a Modified BSD License.
See accompanying file LICENSE.txt or
http://www.opengeosys.org/project/license
*/
#include
<iomanip>
#include
<fstream>
#include
<string>
#ifdef USE_MPI
#include
<mpi.h>
#endif
#ifdef USE_PETSC
#include
<petscksp.h>
#endif
#include
"logog/include/logog.hpp"
#include
"BaseLib/LogogCustomCout.h"
#include
"BaseLib/TemplateLogogFormatterSuppressedGCC.h"
#include
"FileIO/MPI_IO/NodePartitionedMeshReader.h"
#include
"MeshLib/Node.h"
#include
"MeshLib/Elements/Element.h"
using
namespace
MeshLib
;
using
namespace
FileIO
;
int
main
(
int
argc
,
char
*
argv
[])
{
LOGOG_INITIALIZE
();
{
#ifdef USE_MPI
MPI_Init
(
&
argc
,
&
argv
);
#endif
#ifdef USE_PETSC
char
help
[]
=
"ogs6 with PETSc
\n
"
;
PetscInitialize
(
&
argc
,
&
argv
,
nullptr
,
help
);
#endif
BaseLib
::
LogogCustomCout
out
(
1
);
BaseLib
::
TemplateLogogFormatterSuppressedGCC
<
TOPIC_LEVEL_FLAG
|
TOPIC_FILE_NAME_FLAG
|
TOPIC_LINE_NUMBER_FLAG
>
custom_format
;
out
.
SetFormatter
(
custom_format
);
const
std
::
string
file_name
=
argv
[
1
];
NodePartitionedMeshReader
read_pmesh
;
NodePartitionedMesh
*
mesh
=
read_pmesh
.
read
(
MPI_COMM_WORLD
,
file_name
);
int
rank
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
const
std
::
string
rank_str
=
std
::
to_string
(
rank
);
const
std
::
string
ofile_name
=
file_name
+
"_partition_"
+
rank_str
+
".msh"
;
std
::
ofstream
os
(
ofile_name
.
data
(),
std
::
ios
::
trunc
);
// Output nodes
os
.
setf
(
std
::
ios
::
scientific
,
std
::
ios
::
floatfield
);
std
::
setprecision
(
10
);
const
size_t
nn
=
mesh
->
getNNodes
();
for
(
size_t
i
=
0
;
i
<
nn
;
i
++
)
{
const
double
*
x
=
mesh
->
getNode
(
i
)
->
getCoords
();
os
<<
mesh
->
getNode
(
i
)
->
getID
()
<<
" "
<<
std
::
setw
(
14
)
<<
x
[
0
]
<<
" "
<<
x
[
1
]
<<
" "
<<
x
[
2
]
<<
"
\n
"
;
}
os
.
flush
();
// Output elements
const
size_t
ne
=
mesh
->
getNElements
();
for
(
size_t
i
=
0
;
i
<
ne
;
i
++
)
{
const
Element
*
elem
=
mesh
->
getElement
(
i
);
Node
*
const
*
ele_nodes
=
elem
->
getNodes
();
for
(
unsigned
j
=
0
;
j
<
elem
->
getNNodes
();
j
++
)
{
os
<<
ele_nodes
[
j
]
->
getID
()
<<
" "
;
}
os
<<
"
\n
"
;
}
os
.
flush
();
#ifdef USE_PETSC
PetscFinalize
();
#endif
#ifdef USE_MPI
MPI_Finalize
();
#endif
}
// make sure no logog objects exist when LOGOG_SHUTDOWN() is called.
LOGOG_SHUTDOWN
();
}
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