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
4d78f57e
Commit
4d78f57e
authored
12 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
changed algorithm for interpolation of properties
parent
b49cd6a3
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/Mesh2MeshPropertyInterpolation.cpp
+13
-76
13 additions, 76 deletions
MeshLib/Mesh2MeshPropertyInterpolation.cpp
MeshLib/Mesh2MeshPropertyInterpolation.h
+0
-2
0 additions, 2 deletions
MeshLib/Mesh2MeshPropertyInterpolation.h
with
13 additions
and
78 deletions
MeshLib/Mesh2MeshPropertyInterpolation.cpp
+
13
−
76
View file @
4d78f57e
...
@@ -64,37 +64,23 @@ void Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(Mesh *dest_mes
...
@@ -64,37 +64,23 @@ void Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(Mesh *dest_mes
std
::
vector
<
double
>
interpolated_src_node_properties
(
_src_mesh
->
getNNodes
());
std
::
vector
<
double
>
interpolated_src_node_properties
(
_src_mesh
->
getNNodes
());
interpolateElementPropertiesToNodeProperties
(
interpolated_src_node_properties
);
interpolateElementPropertiesToNodeProperties
(
interpolated_src_node_properties
);
// carry over properties from source elements to destination nodes
// looping over the destination elements and calculate properties
// stepping over source nodes of the appropriate source element
// from interpolated_src_node_properties
std
::
vector
<
MeshLib
::
Node
*>
const
&
dest_nodes
(
dest_mesh
->
getNodes
());
std
::
vector
<
MeshLib
::
Node
*>
const
&
src_nodes
(
_src_mesh
->
getNodes
());
const
size_t
n_dest_nodes
(
dest_nodes
.
size
());
const
size_t
n_src_nodes
(
src_nodes
.
size
());
std
::
vector
<
double
>
dest_node_properties
(
n_dest_nodes
);
std
::
vector
<
MeshLib
::
Element
*>
const
&
src_elements
(
_src_mesh
->
getElements
());
const
size_t
n_src_elements
(
src_elements
.
size
());
for
(
size_t
k
(
0
);
k
<
n_dest_nodes
;
k
++
)
{
// search the source element the destination node is in
for
(
size_t
j
(
0
);
j
<
n_src_elements
;
j
++
)
{
if
(
dynamic_cast
<
MeshLib
::
Face
*>
(
src_elements
[
j
])
->
isPntInside
(
*
dynamic_cast
<
GeoLib
::
Point
const
*>
(
dest_nodes
[
k
])))
{
const
size_t
n_nodes_src_element
(
src_elements
[
j
]
->
getNNodes
());
dest_node_properties
[
k
]
=
interpolated_src_node_properties
[(
src_elements
[
j
]
->
getNode
(
0
))
->
getID
()];
for
(
size_t
i
(
1
);
i
<
n_nodes_src_element
;
i
++
)
{
dest_node_properties
[
k
]
+=
interpolated_src_node_properties
[(
src_elements
[
j
]
->
getNode
(
i
))
->
getID
()];
}
}
}
}
// looping over the destination elements and interpolate properties
// from dest_node_properties
std
::
vector
<
MeshLib
::
Element
*>
const
&
dest_elements
(
dest_mesh
->
getElements
());
std
::
vector
<
MeshLib
::
Element
*>
const
&
dest_elements
(
dest_mesh
->
getElements
());
const
size_t
n_dest_elements
(
dest_elements
.
size
());
const
size_t
n_dest_elements
(
dest_elements
.
size
());
for
(
size_t
k
(
0
);
k
<
n_dest_elements
;
k
++
)
{
for
(
size_t
k
(
0
);
k
<
n_dest_elements
;
k
++
)
{
const
size_t
n_nodes_dest_element
(
dest_elements
[
k
]
->
getNNodes
());
size_t
cnt
(
0
);
dest_properties
[
k
]
=
dest_node_properties
[
dest_elements
[
k
]
->
getNode
(
0
)
->
getID
()];
dest_properties
[
k
]
=
0.0
;
for
(
size_t
j
(
1
);
k
<
n_nodes_dest_element
;
k
++
)
{
for
(
size_t
j
(
0
);
j
<
n_src_nodes
;
j
++
)
{
dest_properties
[
k
]
+=
dest_node_properties
[
dest_elements
[
k
]
->
getNode
(
j
)
->
getID
()];
if
(
dynamic_cast
<
MeshLib
::
Face
*>
(
dest_elements
[
k
])
->
isPntInside
(
*
dynamic_cast
<
GeoLib
::
Point
const
*>
(
src_nodes
[
j
])))
{
dest_properties
[
k
]
+=
interpolated_src_node_properties
[
j
];
cnt
++
;
}
}
}
dest_properties
[
k
]
/=
n_nodes_dest_element
;
dest_properties
[
k
]
/=
cnt
;
dest_elements
[
k
]
->
setValue
(
k
);
dest_elements
[
k
]
->
setValue
(
k
);
}
}
}
}
...
@@ -114,53 +100,4 @@ void Mesh2MeshPropertyInterpolation::interpolateElementPropertiesToNodePropertie
...
@@ -114,53 +100,4 @@ void Mesh2MeshPropertyInterpolation::interpolateElementPropertiesToNodePropertie
}
}
}
}
//void Mesh2MeshPropertyInterpolation::interpolatePropertiesForMeshUsingArea(Mesh *dest_mesh, std::vector<double>& dest_properties) const
//{
// // interpolate properties for all all elements of dest_mesh
// std::vector<MeshLib::Element*> const* dest_elements(dest_mesh->getElements());
// const size_t n_dest_elements(dest_elements.size());
// for (size_t k(0); k<n_dest_elements; k++) {
// std::vector<double> interpolation_weights;
// std::vector<double> interpolation_values;
// // find all elements of _src_mesh that have a non empty intersection and compute the (percentaged) part of volume
// {
// const double content_dest_elem(dest_elements[k]->getContent()); // needed for stop criterion
// double sum_of_interpolation_weights(0.0);
// std::vector<MeshLib::Element*> const* src_elements(_src_mesh->getElements());
// const size_t n_src_elements (src_elements.size());
// for (size_t j(0); j<n_src_elements && sum_of_interpolation_weights <= 0.999; j++) {
// double act_interpolation_weight(getIntersectingContent(dest_elements[k], src_elements[j]) / content_dest_elem);
// if (act_interpolation_weight > 0) {
// sum_of_interpolation_weights += act_interpolation_weight;
// interpolation_weights.push_back(act_interpolation_weight);
// interpolation_values.push_back(_src_properties[src_elements[j]->getValue()]);
// }
// }
// }
//
// // create the new property out of the interpolation of properties of the above results
// const size_t n_interpolation_info(interpolation_weights.size());
// double new_prop (0.0);
// for (size_t i(0); i<n_interpolation_info;i++) {
// new_prop += interpolation_weights[i] * interpolation_values[i];
// }
// dest_properties.push_back(new_prop);
//
// // set index of element to the index the new property resides in the vector
// const_cast<MeshLib::Element*>(dest_elements[k])->setValue(dest_properties.size()-1);
// }
//}
//double Mesh2MeshPropertyInterpolation::getIntersectingContent(Element const*const elem0, Element const*const elem1) const
//{
// const unsigned n_edges_0(elem0->getNEdges());
// const unsigned n_edges_1(elem1->getNEdges());
//
// for (unsigned i(0); i<n_edges_0; i++) {
// for (unsigned j(0); k<n_edges_1; j++) {
//
// }
// }
//}
}
// end namespace MeshLib
}
// end namespace MeshLib
This diff is collapsed.
Click to expand it.
MeshLib/Mesh2MeshPropertyInterpolation.h
+
0
−
2
View file @
4d78f57e
...
@@ -61,8 +61,6 @@ private:
...
@@ -61,8 +61,6 @@ private:
*/
*/
void
interpolateElementPropertiesToNodeProperties
(
std
::
vector
<
double
>
&
interpolated_node_properties
)
const
;
void
interpolateElementPropertiesToNodeProperties
(
std
::
vector
<
double
>
&
interpolated_node_properties
)
const
;
// void interpolatePropertiesForMeshUsingArea(Mesh *dest_mesh, std::vector<double>& dest_properties) const;
// double getIntersectingContent(Element const*const element0, Element const*const element1) const;
Mesh
const
*
const
_src_mesh
;
Mesh
const
*
const
_src_mesh
;
std
::
vector
<
double
>
const
*
const
_src_properties
;
std
::
vector
<
double
>
const
*
const
_src_properties
;
};
};
...
...
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