MCPcopy Create free account
hub / github.com/Kitware/VTK / SynchronizeGhostData

Method SynchronizeGhostData

Parallel/DIY/vtkDIYGhostUtilities.cxx:6230–6298  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

6228
6229//----------------------------------------------------------------------------
6230int vtkDIYGhostUtilities::SynchronizeGhostData(std::vector<vtkDataSet*>& inputs,
6231 std::vector<vtkDataSet*>& outputs, vtkMultiProcessController* controller, bool syncCell,
6232 bool syncPoint)
6233{
6234 const int size = static_cast<int>(inputs.size());
6235 if (size != static_cast<int>(outputs.size()))
6236 {
6237 return 0;
6238 }
6239
6240 std::string logMessage = size
6241 ? std::string("Synchronizing ghosts for ") + std::string(outputs[0]->GetClassName())
6242 : std::string("No ghosts to synchronize for empty rank");
6243 vtkLogStartScope(TRACE, logMessage.c_str());
6244
6245 vtkDIYGhostUtilities::CloneInputData(inputs, outputs, syncCell, syncPoint);
6246
6247 vtkLogStartScope(TRACE, "Instantiating diy communicator");
6248 diy::mpi::communicator comm = vtkDIYUtilities::GetCommunicator(controller);
6249 vtkLogEndScope("Instantiating diy communicator");
6250
6251 vtkLogStartScope(TRACE, "Instantiating master");
6252 diy::Master master(
6253 comm, 1, -1, []() { return static_cast<void*>(new DataSetBlock()); },
6254 [](void* b) -> void { delete static_cast<DataSetBlock*>(b); });
6255 vtkLogEndScope("Instantiating master");
6256
6257 vtkLogStartScope(TRACE, "Instantiating assigner");
6258 vtkDIYExplicitAssigner assigner(comm, size);
6259 vtkLogEndScope("Instantiating assigner");
6260
6261 if (!size)
6262 {
6263 // In such instance, we can just terminate. We are empty an finished communicating with other
6264 // ranks.
6265 vtkLogEndScope(logMessage.c_str());
6266 return 1;
6267 }
6268
6269 vtkLogStartScope(TRACE, "Decomposing master");
6270 diy::RegularDecomposer<diy::DiscreteBounds> decomposer(
6271 /*dim*/ 1, diy::interval(0, assigner.nblocks() - 1), assigner.nblocks());
6272 decomposer.decompose(comm.rank(), assigner, master);
6273 vtkLogEndScope("Decomposing master");
6274
6275 // At this step, we gather data from the inputs and store it inside the local blocks
6276 // so we don't have to carry extra parameters later.
6277 vtkLogStartScope(TRACE, "Setup block self information.");
6278 vtkDIYGhostUtilities::InitializeBlocks(master, inputs, syncCell, syncPoint);
6279 vtkLogEndScope("Setup block self information.");
6280
6281 vtkLogStartScope(TRACE, "Exchanging needed ids");
6282 vtkDIYGhostUtilities::ExchangeNeededIds(master, assigner, syncCell, syncPoint);
6283 vtkLogEndScope("Exchanging needed ids");
6284
6285 vtkLogStartScope(TRACE, "Computing link map using needed ids.");
6286 LinkMap linkMap = vtkDIYGhostUtilities::ComputeLinkMapUsingNeededIds(master, syncCell, syncPoint);
6287 vtkLogEndScope("Computing link map using needed ids.");

Callers

nothing calls this directly

Calls 8

intervalFunction · 0.85
stringClass · 0.50
LinkClass · 0.50
sizeMethod · 0.45
GetClassNameMethod · 0.45
c_strMethod · 0.45
nblocksMethod · 0.45
rankMethod · 0.45

Tested by

no test coverage detected