Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
MostafaMollaali
dynamic
Commits
5524c632
Commit
5524c632
authored
6 years ago
by
Dmitri Naumov
Committed by
Dmitri Naumov
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[MGTL] Construct meshes from geometries.
parent
d0c0266c
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
MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp
+113
-0
113 additions, 0 deletions
MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp
MeshGeoToolsLib/ConstructMeshesFromGeometries.h
+29
-0
29 additions, 0 deletions
MeshGeoToolsLib/ConstructMeshesFromGeometries.h
with
142 additions
and
0 deletions
MeshGeoToolsLib/ConstructMeshesFromGeometries.cpp
0 → 100644
+
113
−
0
View file @
5524c632
/**
* \file
* \copyright
* Copyright (c) 2012-2018, 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
"ConstructMeshesFromGeometries.h"
#include
<logog/include/logog.hpp>
#include
"MeshLib/Elements/Element.h"
#include
"MeshLib/MeshEditing/DuplicateMeshComponents.h"
#include
"MeshLib/Node.h"
#include
"BoundaryElementsSearcher.h"
#include
"MeshNodeSearcher.h"
namespace
MeshGeoToolsLib
{
template
<
typename
GeometryVec
>
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
constructAdditionalMeshesFromGeometries
(
std
::
vector
<
GeometryVec
*>
const
&
geometries
,
MeshGeoToolsLib
::
BoundaryElementsSearcher
&
boundary_element_searcher
)
{
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
additional_meshes
;
for
(
GeometryVec
*
const
geometry_vec
:
geometries
)
{
// Each geometry_vec has a name, this is the first part of the full
// name.
auto
const
&
vec_name
=
geometry_vec
->
getName
();
auto
const
&
vec_data
=
*
geometry_vec
->
getVector
();
auto
const
vec_size
=
geometry_vec
->
size
();
for
(
std
::
size_t
i
=
0
;
i
<
vec_size
;
++
i
)
{
// Each geometry has a name, this is the second part of the full
// name.
std
::
string
geometry_name
;
bool
const
is_geometry_named
=
geometry_vec
->
getNameOfElementByID
(
i
,
geometry_name
);
if
(
!
is_geometry_named
)
{
continue
;
}
auto
const
&
geometry
=
*
vec_data
[
i
];
DBUG
(
"Creating mesh from geometry %s %s."
,
vec_name
.
c_str
(),
geometry_name
.
c_str
());
additional_meshes
.
emplace_back
(
createMeshFromElementSelection
(
vec_name
+
"_"
+
geometry_name
,
MeshLib
::
cloneElements
(
boundary_element_searcher
.
getBoundaryElements
(
geometry
))));
}
}
return
additional_meshes
;
}
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
constructAdditionalMeshesFromGeoObjects
(
GeoLib
::
GEOObjects
const
&
geo_objects
,
MeshLib
::
Mesh
const
&
mesh
)
{
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
additional_meshes
;
// TODO (naumov) add config for search length algorithms.
auto
search_length_algorithm
=
std
::
make_unique
<
MeshGeoToolsLib
::
SearchLength
>
();
auto
const
&
mesh_node_searcher
=
MeshGeoToolsLib
::
MeshNodeSearcher
::
getMeshNodeSearcher
(
mesh
,
std
::
move
(
search_length_algorithm
));
MeshGeoToolsLib
::
BoundaryElementsSearcher
boundary_element_searcher
(
mesh
,
mesh_node_searcher
);
//
// Points
//
{
auto
point_meshes
=
constructAdditionalMeshesFromGeometries
(
geo_objects
.
getPoints
(),
boundary_element_searcher
);
std
::
move
(
begin
(
point_meshes
),
end
(
point_meshes
),
std
::
back_inserter
(
additional_meshes
));
}
//
// Polylines
//
{
auto
polyline_meshes
=
constructAdditionalMeshesFromGeometries
(
geo_objects
.
getPolylines
(),
boundary_element_searcher
);
std
::
move
(
begin
(
polyline_meshes
),
end
(
polyline_meshes
),
std
::
back_inserter
(
additional_meshes
));
}
// Surfaces
{
auto
surface_meshes
=
constructAdditionalMeshesFromGeometries
(
geo_objects
.
getSurfaces
(),
boundary_element_searcher
);
std
::
move
(
begin
(
surface_meshes
),
end
(
surface_meshes
),
std
::
back_inserter
(
additional_meshes
));
}
return
additional_meshes
;
}
}
// namespace MeshGeoToolsLib
This diff is collapsed.
Click to expand it.
MeshGeoToolsLib/ConstructMeshesFromGeometries.h
0 → 100644
+
29
−
0
View file @
5524c632
/**
* \file
* \copyright
* Copyright (c) 2012-2018, 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
<memory>
#include
<vector>
#include
"MeshLib/Mesh.h"
namespace
GeoLib
{
class
GEOObjects
;
}
namespace
MeshGeoToolsLib
{
/// For each named geometry in the give geo_objects (defined on the given \c
/// mesh) constructs a mesh corresponding to the geometry with mappings to the
/// bulk mesh elements and nodes.
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
Mesh
>>
constructAdditionalMeshesFromGeoObjects
(
GeoLib
::
GEOObjects
const
&
geo_objects
,
MeshLib
::
Mesh
const
&
mesh
);
}
// namespace MeshGeoToolsLib
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