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
Karsten Rink
ogs
Commits
33bff51d
Commit
33bff51d
authored
5 years ago
by
Karsten Rink
Committed by
Dmitri Naumov
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
formatting + fixing test
parent
77b6c146
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Applications/Utils/MeshEdit/Vtu2Grid.cpp
+13
-11
13 additions, 11 deletions
Applications/Utils/MeshEdit/Vtu2Grid.cpp
Applications/Utils/Tests.cmake
+1
-1
1 addition, 1 deletion
Applications/Utils/Tests.cmake
with
14 additions
and
12 deletions
Applications/Utils/MeshEdit/Vtu2Grid.cpp
+
13
−
11
View file @
33bff51d
/**
* \file
*
* @copyright
* Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
...
...
@@ -28,7 +29,7 @@
#include
<vtkUnstructuredGrid.h>
#include
<vtkXMLUnstructuredGridReader.h>
static
std
::
string
cell_id_name
=
"CellIds"
;
std
::
string
const
cell_id_name
=
"CellIds"
;
std
::
array
<
std
::
size_t
,
3
>
getDimensions
(
MathLib
::
Point3d
const
&
min
,
MathLib
::
Point3d
const
&
max
,
...
...
@@ -42,18 +43,17 @@ std::array<std::size_t, 3> getDimensions(MathLib::Point3d const& min,
};
}
void
assignCellIds
(
vtkSmartPointer
<
vtkUnstructuredGrid
>
const
&
mesh
,
MathLib
::
Point3d
const
&
min
,
std
::
array
<
std
::
size_t
,
3
>
const
&
dims
,
std
::
array
<
double
,
3
>
const
&
cellsize
,
std
::
vector
<
int
>&
cell_ids
)
std
::
vector
<
int
>
assignCellIds
(
vtkSmartPointer
<
vtkUnstructuredGrid
>
const
&
mesh
,
MathLib
::
Point3d
const
&
min
,
std
::
array
<
std
::
size_t
,
3
>
const
&
dims
,
std
::
array
<
double
,
3
>
const
&
cellsize
)
{
vtkSmartPointer
<
vtkCellLocator
>
locator
=
vtkSmartPointer
<
vtkCellLocator
>::
New
();
locator
->
SetDataSet
(
mesh
);
locator
->
Update
();
cell_ids
.
clear
()
;
std
::
vector
<
int
>
cell_ids
;
cell_ids
.
reserve
(
dims
[
0
]
*
dims
[
1
]
*
dims
[
2
]);
std
::
array
<
double
,
3
>
const
grid_max
=
{
min
[
0
]
+
dims
[
0
]
*
cellsize
[
0
],
min
[
1
]
+
dims
[
1
]
*
cellsize
[
1
],
...
...
@@ -72,6 +72,7 @@ void assignCellIds(vtkSmartPointer<vtkUnstructuredGrid> const& mesh,
}
}
}
return
cell_ids
;
}
bool
removeUnusedGridCells
(
vtkSmartPointer
<
vtkUnstructuredGrid
>
const
&
mesh
,
...
...
@@ -130,7 +131,7 @@ void mapMeshArraysOntoGrid(vtkSmartPointer<vtkUnstructuredGrid> const& mesh,
mapArray
<
int
,
vtkSmartPointer
<
vtkIntArray
>>
(
*
grid
,
int_arr
,
name
);
continue
;
}
WARN
(
"Ignoring array
\"
%s
\"
..."
,
name
.
c_str
());
WARN
(
"Ignoring array
'%s'
..."
,
name
.
c_str
());
}
}
...
...
@@ -198,8 +199,7 @@ int main (int argc, char* argv[])
reader
->
Update
();
vtkSmartPointer
<
vtkUnstructuredGrid
>
mesh
=
reader
->
GetOutput
();
double
bounds
[
6
];
mesh
->
GetBounds
(
bounds
);
double
*
bounds
=
mesh
->
GetBounds
();
MathLib
::
Point3d
const
min
(
std
::
array
<
double
,
3
>
{
bounds
[
0
],
bounds
[
2
],
bounds
[
4
]});
MathLib
::
Point3d
const
max
(
std
::
array
<
double
,
3
>
{
bounds
[
1
],
bounds
[
3
],
bounds
[
5
]});
std
::
array
<
std
::
size_t
,
3
>
const
dims
=
getDimensions
(
min
,
max
,
cellsize
);
...
...
@@ -208,10 +208,12 @@ int main (int argc, char* argv[])
dims
[
0
],
dims
[
1
],
dims
[
2
],
cellsize
[
0
],
cellsize
[
1
],
cellsize
[
2
],
min
,
"grid"
));
std
::
vector
<
int
>
const
tmp_ids
=
assignCellIds
(
mesh
,
min
,
dims
,
cellsize
);
std
::
vector
<
int
>&
cell_ids
=
*
grid
->
getProperties
().
createNewPropertyVector
<
int
>
(
cell_id_name
,
MeshLib
::
MeshItemType
::
Cell
,
1
);
assignCellIds
(
mesh
,
min
,
dims
,
cellsize
,
cell_ids
);
std
::
copy
(
tmp_ids
.
cbegin
(),
tmp_ids
.
cend
(),
std
::
back_inserter
(
cell_ids
)
)
;
if
(
!
removeUnusedGridCells
(
mesh
,
grid
))
return
EXIT_FAILURE
;
...
...
This diff is collapsed.
Click to expand it.
Applications/Utils/Tests.cmake
+
1
−
1
View file @
33bff51d
...
...
@@ -283,5 +283,5 @@ AddTest(
REQUIREMENTS NOT OGS_USE_MPI
TESTER vtkdiff
DIFF_DATA
AmmerSubsurface
Coarse
.vtu AmmerGridOutput.vtu MaterialIDs MaterialIDs 0 0
AmmerSubsurface
Grid
.vtu AmmerGridOutput.vtu MaterialIDs MaterialIDs 0 0
)
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