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
9e07f64e
Commit
9e07f64e
authored
9 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Prevent creating temporary object for calling grid.getNearestPoint().
parent
beffa1ce
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
MeshGeoToolsLib/GeoMapper.cpp
+1
-2
1 addition, 2 deletions
MeshGeoToolsLib/GeoMapper.cpp
MeshGeoToolsLib/MeshNodeSearcher.cpp
+1
-1
1 addition, 1 deletion
MeshGeoToolsLib/MeshNodeSearcher.cpp
SimpleTests/MeshTests/MeshSearchTest.cpp
+3
-3
3 additions, 3 deletions
SimpleTests/MeshTests/MeshSearchTest.cpp
with
5 additions
and
6 deletions
MeshGeoToolsLib/GeoMapper.cpp
+
1
−
2
View file @
9e07f64e
...
@@ -153,8 +153,7 @@ float GeoMapper::getDemElevation(GeoLib::Point const& pnt) const
...
@@ -153,8 +153,7 @@ float GeoMapper::getDemElevation(GeoLib::Point const& pnt) const
double
GeoMapper
::
getMeshElevation
(
double
x
,
double
y
,
double
min_val
,
double
max_val
)
const
double
GeoMapper
::
getMeshElevation
(
double
x
,
double
y
,
double
min_val
,
double
max_val
)
const
{
{
double
coords
[
3
]
=
{
x
,
y
,
0
};
const
MeshLib
::
Node
*
pnt
=
_grid
->
getNearestPoint
(
MathLib
::
Point3d
{{{
x
,
y
,
0
}}});
const
MeshLib
::
Node
*
pnt
=
_grid
->
getNearestPoint
(
coords
);
const
std
::
vector
<
MeshLib
::
Element
*>
elements
(
_mesh
->
getNode
(
pnt
->
getID
())
->
getElements
());
const
std
::
vector
<
MeshLib
::
Element
*>
elements
(
_mesh
->
getNode
(
pnt
->
getID
())
->
getElements
());
GeoLib
::
Point
*
intersection
(
nullptr
);
GeoLib
::
Point
*
intersection
(
nullptr
);
...
...
This diff is collapsed.
Click to expand it.
MeshGeoToolsLib/MeshNodeSearcher.cpp
+
1
−
1
View file @
9e07f64e
...
@@ -74,7 +74,7 @@ std::vector<std::size_t> MeshNodeSearcher::getMeshNodeIDs(GeoLib::GeoObject cons
...
@@ -74,7 +74,7 @@ std::vector<std::size_t> MeshNodeSearcher::getMeshNodeIDs(GeoLib::GeoObject cons
boost
::
optional
<
std
::
size_t
>
MeshNodeSearcher
::
getMeshNodeIDForPoint
(
GeoLib
::
Point
const
&
pnt
)
const
boost
::
optional
<
std
::
size_t
>
MeshNodeSearcher
::
getMeshNodeIDForPoint
(
GeoLib
::
Point
const
&
pnt
)
const
{
{
const
MeshLib
::
Node
*
found
=
_mesh_grid
.
getNearestPoint
(
pnt
.
getCoords
()
);
const
MeshLib
::
Node
*
found
=
_mesh_grid
.
getNearestPoint
(
pnt
);
if
(
found
)
if
(
found
)
return
found
->
getID
();
return
found
->
getID
();
else
else
...
...
This diff is collapsed.
Click to expand it.
SimpleTests/MeshTests/MeshSearchTest.cpp
+
3
−
3
View file @
9e07f64e
...
@@ -59,7 +59,7 @@ void testMeshGridAlgorithm(MeshLib::Mesh const*const mesh,
...
@@ -59,7 +59,7 @@ void testMeshGridAlgorithm(MeshLib::Mesh const*const mesh,
INFO
(
"[MeshGridAlgorithm] searching %d points ..."
,
pnts_for_search
.
size
());
INFO
(
"[MeshGridAlgorithm] searching %d points ..."
,
pnts_for_search
.
size
());
clock_t
start
=
clock
();
clock_t
start
=
clock
();
for
(
size_t
k
(
0
);
k
<
n_pnts_for_search
;
k
++
)
{
for
(
size_t
k
(
0
);
k
<
n_pnts_for_search
;
k
++
)
{
MeshLib
::
Node
const
*
node
(
mesh_grid
.
getNearestPoint
(
pnts_for_search
[
k
]
->
getCoords
()
));
MeshLib
::
Node
const
*
node
(
mesh_grid
.
getNearestPoint
(
*
pnts_for_search
[
k
]));
idx_found_nodes
.
push_back
(
node
->
getID
());
idx_found_nodes
.
push_back
(
node
->
getID
());
}
}
clock_t
stop
=
clock
();
clock_t
stop
=
clock
();
...
@@ -83,7 +83,7 @@ void testMeshGridAlgorithm(MeshLib::Mesh const*const mesh,
...
@@ -83,7 +83,7 @@ void testMeshGridAlgorithm(MeshLib::Mesh const*const mesh,
INFO
(
"[MeshGridAlgorithm] searching %d points ..."
,
pnts_for_search
.
size
());
INFO
(
"[MeshGridAlgorithm] searching %d points ..."
,
pnts_for_search
.
size
());
clock_t
start
=
clock
();
clock_t
start
=
clock
();
for
(
size_t
k
(
0
);
k
<
n_pnts_for_search
;
k
++
)
{
for
(
size_t
k
(
0
);
k
<
n_pnts_for_search
;
k
++
)
{
MeshLib
::
Node
const
*
node
(
mesh_grid
.
getNearestPoint
(
pnts_for_search
[
k
]
->
getCoords
()
));
MeshLib
::
Node
const
*
node
(
mesh_grid
.
getNearestPoint
(
pnts_for_search
[
k
]));
idx_found_nodes
.
push_back
(
node
->
getID
());
idx_found_nodes
.
push_back
(
node
->
getID
());
}
}
clock_t
stop
=
clock
();
clock_t
stop
=
clock
();
...
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
...
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
std
::
vector
<
GeoLib
::
Point
*>
pnts_for_search
;
std
::
vector
<
GeoLib
::
Point
*>
pnts_for_search
;
unsigned
n
(
std
::
min
(
static_cast
<
unsigned
>
(
nodes
.
size
()),
number_arg
.
getValue
()));
unsigned
n
(
std
::
min
(
static_cast
<
unsigned
>
(
nodes
.
size
()),
number_arg
.
getValue
()));
for
(
size_t
k
(
0
);
k
<
n
;
k
++
)
{
for
(
size_t
k
(
0
);
k
<
n
;
k
++
)
{
pnts_for_search
.
push_back
(
new
GeoLib
::
Point
(
nodes
[
k
]
->
getCoords
()
));
pnts_for_search
.
push_back
(
new
GeoLib
::
Point
(
nodes
[
k
]));
}
}
std
::
vector
<
size_t
>
idx_found_nodes
;
std
::
vector
<
size_t
>
idx_found_nodes
;
...
...
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