Hello,
I am currently using crack_mesh_cut.cpp script to cut a mesh where the input file is not a restart file.
My goal is to produce a mesh with only one bitRefLevel and therefore only the cut mesh (preserving the initial cutting surface is not an issue).
The current available code produces a mesh where 3 bits:
There are 3 bit ref levels:
mapBitLevel["spatial_domain"]
mapBitLevel["material_domain"]
In other words the output file has coexisting bits.
I am aware that the problem is that the bits need to be squashed.
However, when squashing bit, entities associated to a bit ref are deleted when using function shiftRightBitRef:
Hence, the end result is getting back the original mesh with a single BitRefLevel.
If I squash one less, I have 2 meshes Coexisting and 2 bits.
I managed to delete the part of the mesh that is related to the unwanted pre-cut tets and keep the wanted mesh, however bits are unsqusashed.
If I squash bit using shiftRightBitRef, I end up with a mesh that has 1 bitRefLevel but all the new tets generated by cutting are deleted as shiftRightBitRef deletes them.
Then I tried to just
squash the bits by this snipet that avoids deleting the entities:
BitRefLevel bit = cp.mapBitLevel["spatial_domain"];
std::size_t idx = 0;
while (!bit.test(idx))
++idx;
int last_bit = idx+1;
cerr << "last_bit " << last_bit << "\n";
BitRefLevel shift_mask;
for (int ll = 0; ll != last_bit; ++ll)
shift_mask.set(ll);
auto ref_ents_ptr = m_field.get_ref_ents();
RefEntity_change_right_shift right_shift(1, shift_mask);
for (int ii = 0; ii < last_bit; ii++) {
// delete bits on the right which are shifted to zero
BitRefLevel delete_bits = BitRefLevel().set(0) & shift_mask;
for (RefEntity_multiIndex::iterator ent_it = ref_ents_ptr->begin();
ent_it != ref_ents_ptr->end(); ent_it++) {
MOFEM_LOG_FUNCTION();
MOFEM_LOG("BitRefSelf", Sev::noisy)
<< (*ent_it)->getBitRefLevel() << " : ";
right_shift(const_cast<boost::shared_ptr<RefEntity> &>(*ent_it));
MOFEM_LOG_FUNCTION();
MOFEM_LOG("BitRefSelf", Sev::noisy) << (*ent_it)->getBitRefLevel();
}
}
but bits are not squashed.
I think that there is something fundamental I am not.
Any help will be appreciated.
Thanks in advance.
Ignatios