Skip to content
Snippets Groups Projects
Commit d20af8a0 authored by Tom Fischer's avatar Tom Fischer
Browse files

[A/U/MP] Move check in copyPropertyVector.

parent 1c2a2f11
No related branches found
No related tags found
No related merge requests found
...@@ -221,26 +221,19 @@ void NodeWiseMeshPartitioner::processProperties() ...@@ -221,26 +221,19 @@ void NodeWiseMeshPartitioner::processProperties()
auto property_names = original_properties.getPropertyVectorNames(); auto property_names = original_properties.getPropertyVectorNames();
for (auto const& name : property_names) for (auto const& name : property_names)
{ {
if (original_properties.existsPropertyVector<double>(name)) bool success =
{ copyPropertyVector<double>(name, total_number_of_tuples) ||
copyPropertyVector<double>(name, total_number_of_tuples); copyPropertyVector<float>(name, total_number_of_tuples) ||
} copyPropertyVector<int>(name, total_number_of_tuples) ||
else if (original_properties.existsPropertyVector<float>(name)) copyPropertyVector<long>(name, total_number_of_tuples) ||
{ copyPropertyVector<unsigned>(name, total_number_of_tuples) ||
copyPropertyVector<float>(name, total_number_of_tuples); copyPropertyVector<unsigned long>(name, total_number_of_tuples) ||
}
else if (original_properties.existsPropertyVector<int>(name))
{
copyPropertyVector<int>(name, total_number_of_tuples);
}
else if (original_properties.existsPropertyVector<long>(name))
{
copyPropertyVector<long>(name, total_number_of_tuples);
}
else if (original_properties.existsPropertyVector<std::size_t>(name))
{
copyPropertyVector<std::size_t>(name, total_number_of_tuples); copyPropertyVector<std::size_t>(name, total_number_of_tuples);
} if (!success)
WARN(
"processProperties: Could not create partitioned "
"PropertyVector '%s'.",
name.c_str());
} }
} }
......
...@@ -171,10 +171,13 @@ private: ...@@ -171,10 +171,13 @@ private:
void processProperties(); void processProperties();
template <typename T> template <typename T>
void copyPropertyVector(std::string const& name, bool copyPropertyVector(std::string const& name,
std::size_t const total_number_of_tuples) std::size_t const total_number_of_tuples)
{ {
auto const& original_properties(_mesh->getProperties()); auto const& original_properties(_mesh->getProperties());
if (!original_properties.existsPropertyVector<T>(name))
return false;
auto const& pv(original_properties.getPropertyVector<T>(name)); auto const& pv(original_properties.getPropertyVector<T>(name));
auto partitioned_pv = auto partitioned_pv =
_partitioned_properties.createNewPropertyVector<T>( _partitioned_properties.createNewPropertyVector<T>(
...@@ -191,6 +194,7 @@ private: ...@@ -191,6 +194,7 @@ private:
} }
position_offset += p.nodes.size(); position_offset += p.nodes.size();
} }
return true;
} }
template <typename T> template <typename T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment