Skip to content

Commit

Permalink
delete unprepared case
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangyu-Hu committed Dec 16, 2024
1 parent 4c98ac7 commit 29c34ee
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 448 deletions.
45 changes: 42 additions & 3 deletions src/shared/bodies/base_body_part.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ void BodyPartByParticle::tagParticles(TaggingParticleMethod &tagging_particle_me
{ return body_part_particles_[i]; });
sv_range_size_ = base_particles_.addUniqueSingularVariableOnly<UnsignedInt>(
body_part_name_ + "_Size", body_part_particles_.size());
};
}
//=============================================================================================//
BodyPartByCell::BodyPartByCell(RealBody &real_body, const std::string &body_part_name)
: BodyPart(real_body, body_part_name),
cell_linked_list_(DynamicCast<CellLinkedList>(this, real_body.getCellLinkedList())) {}
//=============================================================================================//
size_t BodyPartByCell::SizeOfLoopRange()
{
Expand All @@ -36,11 +40,46 @@ size_t BodyPartByCell::SizeOfLoopRange()
size_of_loop_range += body_part_cells_[i]->size();
}
return size_of_loop_range;
};
}
//=================================================================================================//
void BodyPartByCell::tagCells(TaggingCellMethod &tagging_cell_method)
{
cell_linked_list_.tagBodyPartByCell(body_part_cells_, tagging_cell_method);
ConcurrentVec<size_t> cell_list;
Arrayi all_cells = cell_linked_list_.AllCells();
Real grid_spacing = cell_linked_list_.GridSpacing();
mesh_parallel_for(
MeshRange(Arrayi::Zero(), all_cells),
[&](const Arrayi &cell_index)
{
bool is_included = false;
mesh_for_each(
Arrayi::Zero().max(cell_index - Arrayi::Ones()),
all_cells.min(cell_index + 2 * Arrayi::Ones()),
[&](const Arrayi &neighbor_cell_index)
{
if (tagging_cell_method(
cell_linked_list_
.CellPositionFromIndex(neighbor_cell_index),
grid_spacing))
{
is_included = true;
}
});
if (is_included == true)
cell_list.push_back(cell_linked_list_.LinearCellIndexFromCellIndex(cell_index));
});

ConcurrentIndexVector *cell_index_lists = cell_linked_list_.getCellIndexLists();
for (size_t i = 0; i != cell_list.size(); ++i)
{
body_part_cells_.push_back(&cell_index_lists[cell_list[i]]);
}

dv_index_list_ = base_particles_.addUniqueDiscreteVariableOnly<UnsignedInt>(
body_part_name_, cell_list.size(), [&](size_t i) -> Real
{ return cell_list[i]; });
sv_range_size_ = base_particles_.addUniqueSingularVariableOnly<UnsignedInt>(
body_part_name_ + "_Size", cell_list.size());
}
//=================================================================================================//
BodyRegionByParticle::
Expand Down
5 changes: 2 additions & 3 deletions src/shared/bodies/base_body_part.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,11 @@ class BodyPartByCell : public BodyPart
ConcurrentCellLists &LoopRange() { return body_part_cells_; };
size_t SizeOfLoopRange();

BodyPartByCell(RealBody &real_body, const std::string &body_part_name)
: BodyPart(real_body, body_part_name), cell_linked_list_(real_body.getCellLinkedList()){};
BodyPartByCell(RealBody &real_body, const std::string &body_part_name);
virtual ~BodyPartByCell(){};

protected:
BaseCellLinkedList &cell_linked_list_;
CellLinkedList &cell_linked_list_;
typedef std::function<bool(Vecd, Real)> TaggingCellMethod;
void tagCells(TaggingCellMethod &tagging_cell_method);
};
Expand Down
1 change: 1 addition & 0 deletions src/shared/meshes/cell_linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class CellLinkedList : public BaseCellLinkedList, public Mesh
UnsignedInt getCellOffsetListSize() { return cell_offset_list_size_; };
DiscreteVariable<UnsignedInt> *getParticleIndex() { return dv_particle_index_; };
DiscreteVariable<UnsignedInt> *getCellOffset() { return dv_cell_offset_; };
ConcurrentIndexVector *getCellIndexLists() {return cell_index_lists_; };

/** split algorithm */;
template <class LocalDynamicsFunction>
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 29c34ee

Please sign in to comment.