Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Introducing proper insert method to PointerVectorSet #12087

Merged
merged 31 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e1702fd
implement set_address_identity_function
sunethwarna Feb 19, 2024
0520260
use set_address_identity_function
sunethwarna Feb 19, 2024
abaeedd
add insert methods to ptrvecset
sunethwarna Feb 19, 2024
4b34963
add insert tests
sunethwarna Feb 19, 2024
1a226e4
set mSortedPartSize = mData.size()
sunethwarna Feb 19, 2024
770d666
add the inserts to the end
sunethwarna Feb 19, 2024
b3a9a76
revert elimination builder and solver changes
sunethwarna Feb 19, 2024
b0ef86b
change dofarraytype
sunethwarna Feb 19, 2024
f5a7f05
fix ranged insert bug with end
sunethwarna Feb 19, 2024
8dfbe09
fix mmg reordering
sunethwarna Feb 20, 2024
f2f3dcc
fix dof updater
sunethwarna Feb 20, 2024
1c9af8e
add additional reserve
sunethwarna Feb 20, 2024
d0ef0e7
add another insertion method
sunethwarna Feb 20, 2024
3544a66
Merge remote-tracking branch 'origin/master' into core/pointer_vector…
sunethwarna Feb 22, 2024
9c00f71
introduce set function
sunethwarna Feb 22, 2024
8b04cec
define IndexedObject operators
sunethwarna Feb 22, 2024
e86088b
use set function in PointerVectorSet
sunethwarna Feb 22, 2024
5760f73
add operator== to closest_point
sunethwarna Feb 23, 2024
bc46807
Merge remote-tracking branch 'origin/master' into core/pointer_vector…
sunethwarna Feb 26, 2024
6e7a68f
use cbegin()
sunethwarna Feb 26, 2024
f604617
add additional insert mechanism and test
sunethwarna Feb 27, 2024
b1bc015
Merge remote-tracking branch 'origin/master' into core/pointer_vector…
sunethwarna Mar 6, 2024
1437a25
remove use of *::base()
sunethwarna Mar 6, 2024
8c58384
Merge remote-tracking branch 'origin/master' into core/pointer_vector…
sunethwarna May 29, 2024
f84b135
add reserve
sunethwarna May 29, 2024
b82885c
avoid calling insert
sunethwarna May 29, 2024
0555c33
change name
sunethwarna Jun 5, 2024
4e5f741
add additional iterator tests
sunethwarna Jun 5, 2024
2cfaa7b
remove operator def
sunethwarna Jun 5, 2024
ebea638
Merge remote-tracking branch 'origin/master' into core/pointer_vector…
sunethwarna Jun 5, 2024
359f87e
revert
sunethwarna Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ bool PointWithId::operator<(const PointWithId& rOther) const
return mDistance < rOther.mDistance;
}

bool PointWithId::operator==(const PointWithId& rOther) const
{
return Point::operator==(rOther);
}

void PointWithId::save(Serializer &rSerializer) const
{
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, IndexedObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class KRATOS_API(MAPPING_APPLICATION) PointWithId : public IndexedObject, public

bool operator<(const PointWithId& rOther) const;

bool operator==(const PointWithId& rOther) const;

double GetDistance() const { return mDistance; }

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/* The mappers includes */
#include "spaces/ublas_space.h"
#include "mappers/mapper_flags.h"
#include "factories/mapper_factory.h"
#include "factories/mapper_factory.h"

// NOTE: The following contains the license of the MMG library
/* =============================================================================
Expand Down Expand Up @@ -366,6 +366,10 @@ void MmgProcess<TMMGLibrary>::InitializeMeshData()
for (auto it_dof = mDofs.begin(); it_dof != mDofs.end(); ++it_dof)
(**it_dof).FreeDof();

mrThisModelPart.Nodes().Unique();
mrThisModelPart.Conditions().Unique();
mrThisModelPart.Elements().Unique();

// Generate the maps of reference
mMmgUtilities.GenerateReferenceMaps(mrThisModelPart, aux_ref_cond, aux_ref_elem, mpRefCondition, mpRefElement);

Expand Down Expand Up @@ -590,7 +594,7 @@ void MmgProcess<TMMGLibrary>::ExecuteRemeshing()
ModelPart& r_old_auxiliar_model_part = r_old_model_part.GetSubModelPart("AUXILIAR_COLLAPSED_PRISMS");
ModelPart& r_auxiliary_model_part = mrThisModelPart.GetSubModelPart("AUXILIAR_COLLAPSED_PRISMS");

// Define mapper factory
// Define mapper factory
DEFINE_MAPPER_FACTORY_SERIAL
if (MapperFactoryType::HasMapper("nearest_element") && mThisParameters["use_mapper_if_available"].GetBool()) {
KRATOS_INFO_IF("MmgProcess", mEchoLevel > 0) << "Using MappingApplication to interpolate values" << std::endl;
Expand Down Expand Up @@ -1501,7 +1505,7 @@ const Parameters MmgProcess<TMMGLibrary>::GetDefaultParameters() const
"max_num_search_iterations" : 8,
"echo_level" : 0
}
},
},
"extrapolate_contour_values" : true,
"surface_elements" : false,
"search_parameters" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2854,7 +2854,7 @@ void MmgUtilities<MMGLibrary::MMG2D>::SetLocalParameter(
double HMin,
double HMax,
double HausdorffValue
)
)
{
if ( MMG2D_Set_localParameter(mMmgMesh, mMmgMet, MMG5_Edg, rColor, HMin, HMax, HausdorffValue) != 1)
KRATOS_ERROR << "Unable to set local parameter" << std::endl;
Expand All @@ -2869,7 +2869,7 @@ void MmgUtilities<MMGLibrary::MMG3D>::SetLocalParameter(
double HMin,
double HMax,
double HausdorffValue
)
)
{
if ( MMG3D_Set_localParameter(mMmgMesh, mMmgMet, MMG5_Triangle, rColor, HMin, HMax, HausdorffValue) != 1)
KRATOS_ERROR << "Unable to set local parameter" << std::endl;
Expand All @@ -2884,7 +2884,7 @@ void MmgUtilities<MMGLibrary::MMGS>::SetLocalParameter(
double HMin,
double HMax,
double HausdorffValue
)
)
{
if ( MMGS_Set_localParameter(mMmgMesh, mMmgMet, MMG5_Triangle, rColor, HMin, HMax, HausdorffValue) != 1)
KRATOS_ERROR << "Unable to set local parameter" << std::endl;
Expand Down Expand Up @@ -3578,6 +3578,10 @@ void MmgUtilities<TMMGLibrary>::ReorderAllIds(ModelPart& rModelPart)
for(IndexType i = 0; i < r_elements_array.size(); ++i)
(it_elem_begin + i)->SetId(i + 1);

r_nodes_array.Unique();
r_conditions_array.Unique();
r_elements_array.Unique();

KRATOS_CATCH("");
}

Expand Down Expand Up @@ -3801,6 +3805,8 @@ void MmgUtilities<TMMGLibrary>::GenerateMeshDataFromModelPart(
}
}

r_nodes_array.Unique();

/* Conditions */
counter_to_remesh = block_for_each<SumReduction<IndexType>>(
r_conditions_array,
Expand Down Expand Up @@ -3829,6 +3835,8 @@ void MmgUtilities<TMMGLibrary>::GenerateMeshDataFromModelPart(
}
}

r_conditions_array.Unique();

/* Elements */
counter_to_remesh = block_for_each<SumReduction<IndexType>>(
r_elements_array,
Expand Down Expand Up @@ -3857,6 +3865,8 @@ void MmgUtilities<TMMGLibrary>::GenerateMeshDataFromModelPart(
}
}

r_elements_array.Unique();

// Now we compute the colors
rColors.clear();
ColorsMapType nodes_colors, cond_colors, elem_colors;
Expand Down
Loading
Loading