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
Chaofan Chen
ogs
Commits
e3c25372
Commit
e3c25372
authored
4 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MeL/ME] More readable / meaningful arg. name.
parent
7f0d186f
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
MeshLib/MeshEditing/RasterDataToMesh.cpp
+16
-12
16 additions, 12 deletions
MeshLib/MeshEditing/RasterDataToMesh.cpp
MeshLib/MeshEditing/RasterDataToMesh.h
+4
-2
4 additions, 2 deletions
MeshLib/MeshEditing/RasterDataToMesh.h
with
20 additions
and
14 deletions
MeshLib/MeshEditing/RasterDataToMesh.cpp
+
16
−
12
View file @
e3c25372
...
...
@@ -18,7 +18,6 @@ namespace MeshLib
namespace
RasterDataToMesh
{
static
bool
checkMesh
(
MeshLib
::
Mesh
const
&
mesh
)
{
if
(
mesh
.
getDimension
()
>
2
)
...
...
@@ -50,11 +49,12 @@ static double evaluatePixel(double const value, double const no_data,
{
return
replacement
;
}
return
value
;
return
value
;
}
bool
projectToNodes
(
MeshLib
::
Mesh
&
mesh
,
GeoLib
::
Raster
const
&
raster
,
double
const
def
,
std
::
string
const
&
array_name
)
double
const
default_replacement
,
std
::
string
const
&
array_name
)
{
if
(
!
checkMesh
(
mesh
))
{
...
...
@@ -68,15 +68,17 @@ bool projectToNodes(MeshLib::Mesh& mesh, GeoLib::Raster const& raster,
auto
vec
=
props
.
createNewPropertyVector
<
double
>
(
name
,
MeshLib
::
MeshItemType
::
Node
,
1
);
double
const
no_data
=
raster
.
getHeader
().
no_data
;
std
::
transform
(
nodes
.
cbegin
(),
nodes
.
cend
(),
std
::
back_inserter
(
*
vec
),
[
&
](
auto
const
node
)
{
return
evaluatePixel
(
raster
.
getValueAtPoint
(
*
node
),
no_data
,
def
);
});
std
::
transform
(
nodes
.
cbegin
(),
nodes
.
cend
(),
std
::
back_inserter
(
*
vec
),
[
&
](
auto
const
node
)
{
return
evaluatePixel
(
raster
.
getValueAtPoint
(
*
node
),
no_data
,
default_replacement
);
});
return
true
;
}
bool
projectToElements
(
MeshLib
::
Mesh
&
mesh
,
GeoLib
::
Raster
const
&
raster
,
double
const
def
,
std
::
string
const
&
array_name
)
double
const
default_replacement
,
std
::
string
const
&
array_name
)
{
if
(
!
checkMesh
(
mesh
))
{
...
...
@@ -90,10 +92,12 @@ bool projectToElements(MeshLib::Mesh& mesh, GeoLib::Raster const& raster,
auto
vec
=
props
.
createNewPropertyVector
<
double
>
(
name
,
MeshLib
::
MeshItemType
::
Cell
,
1
);
double
const
no_data
=
raster
.
getHeader
().
no_data
;
std
::
transform
(
elems
.
cbegin
(),
elems
.
cend
(),
std
::
back_inserter
(
*
vec
),
[
&
](
auto
const
elem
)
{
auto
node
=
elem
->
getCenterOfGravity
();
return
evaluatePixel
(
raster
.
getValueAtPoint
(
node
),
no_data
,
def
);
});
std
::
transform
(
elems
.
cbegin
(),
elems
.
cend
(),
std
::
back_inserter
(
*
vec
),
[
&
](
auto
const
elem
)
{
auto
node
=
elem
->
getCenterOfGravity
();
return
evaluatePixel
(
raster
.
getValueAtPoint
(
node
),
no_data
,
default_replacement
);
});
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshEditing/RasterDataToMesh.h
+
4
−
2
View file @
e3c25372
...
...
@@ -23,9 +23,11 @@ namespace MeshLib
namespace
RasterDataToMesh
{
bool
projectToNodes
(
MeshLib
::
Mesh
&
mesh
,
GeoLib
::
Raster
const
&
raster
,
double
const
def
,
std
::
string
const
&
array_name
);
double
const
default_replacement
,
std
::
string
const
&
array_name
);
bool
projectToElements
(
MeshLib
::
Mesh
&
mesh
,
GeoLib
::
Raster
const
&
raster
,
double
const
def
,
std
::
string
const
&
array_name
);
double
const
default_replacement
,
std
::
string
const
&
array_name
);
}
// end namespace RasterDataToMesh
}
// end namespace MeshLib
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