MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / initializeHierarchyDependentData

Method initializeHierarchyDependentData

src/IB/IBInstrumentPanel.cpp:689–914  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687} // initializeHierarchyIndependentData
688
689void
690IBInstrumentPanel::initializeHierarchyDependentData(const Pointer<PatchHierarchy<NDIM>> hierarchy,
691 LDataManager* const l_data_manager,
692 const int timestep_num,
693 const double data_time)
694{
695 if (!d_initialized)
696 {
697 initializeHierarchyIndependentData(hierarchy, l_data_manager);
698 }
699 if (d_num_meters == 0) return;
700
701 IBAMR_TIMER_START(t_initialize_hierarchy_dependent_data);
702
703 const int coarsest_ln = 0;
704 const int finest_ln = hierarchy->getFinestLevelNumber();
705
706 // Keep track of the timestep number and time at which the instrument data
707 // was collected.
708 d_instrument_read_timestep_num = timestep_num;
709 d_instrument_read_time = data_time;
710
711 // Loop over all local nodes to determine the positions of the local
712 // perimeter nodes.
713 for (unsigned int m = 0; m < d_num_meters; ++m)
714 {
715 for (int n = 0; n < d_num_perimeter_nodes[m]; ++n)
716 {
717 d_X_perimeter[m][n] = Point::Zero();
718 }
719 }
720 for (int ln = coarsest_ln; ln <= finest_ln; ++ln)
721 {
722 if (l_data_manager->levelContainsLagrangianData(ln))
723 {
724 // Extract the local position array.
725 Pointer<LData> X_data = l_data_manager->getLData(LDataManager::POSN_DATA_NAME, ln);
726 Vec X_vec = X_data->getVec();
727 double* X_arr;
728 int ierr = VecGetArray(X_vec, &X_arr);
729 IBTK_CHKERRQ(ierr);
730
731 // Store the local positions of the perimeter nodes.
732 const Pointer<LMesh> mesh = l_data_manager->getLMesh(ln);
733 const std::vector<LNode*>& local_nodes = mesh->getLocalNodes();
734 for (const auto& node_idx : local_nodes)
735 {
736 const IBInstrumentationSpec* const spec = node_idx->getNodeDataItem<IBInstrumentationSpec>();
737 if (spec)
738 {
739 const int& petsc_idx = node_idx->getLocalPETScIndex();
740 const double* const X = &X_arr[NDIM * petsc_idx];
741 const int m = spec->getMeterIndex();
742 const int n = spec->getNodeIndex();
743 std::copy(X, X + NDIM, d_X_perimeter[m][n].data());
744 }
745 }
746

Callers 2

Calls 15

sumReductionFunction · 0.85
fillFunction · 0.85
init_meter_elementsFunction · 0.85
getLDataMethod · 0.80
getVecMethod · 0.80
getLMeshMethod · 0.80
getLocalPETScIndexMethod · 0.80
getPatchLevelMethod · 0.80
ceilFunction · 0.50
getFinestLevelNumberMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected