Changeset 177495 for src/comm/mpi
- Timestamp:
- Apr 17, 2013, 6:35:40 PM (13 years ago)
- Children:
- 4f3474
- Parents:
- d6a338
- Location:
- src/comm/mpi
- Files:
-
- 2 edited
-
settings.cpp (modified) (3 diffs)
-
settings.hpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/comm/mpi/settings.cpp
rd6a338 r177495 44 44 #include <string> 45 45 46 #include "base/index.hpp" 46 47 #include "comm/comm.hpp" 47 48 #include "comm/mpi/settings.hpp" 49 #include "discretization/boundary_value_setter.hpp" 48 50 #include "grid/multigrid.hpp" 49 51 #include "grid/tempgrid.hpp" … … 218 220 AddDatatypeGlobal(FinerGrid(sol(i-1)), sol(i), 1); 219 221 } 222 223 InitializeBoundaryValues(); 220 224 } 221 225 … … 428 432 } 429 433 434 void VMG::MPI::Settings::InitializeBoundaryValues() 435 { 436 assert(bv_ranks.size() == 0); 437 438 if (MG::GetFactory().TestObject("BOUNDARY_VALUE_SETTER")) { 439 440 Index coord; 441 442 const int level_index = MG::GetRhs()->MaxLevel() - MG::GetRhs()->GlobalMaxLevel(); 443 const std::vector<BoundaryValue>& bvs = MG::GetBoundaryValueSetter()->BoundaryValues(); 444 const std::map<Index, std::vector<GlobalIndices> >& global = MG::GetComm()->DecomposedGlobal(); 445 446 assert(global.find(0)->second[level_index].BoundaryType() == GlobalMax); 447 448 MPI_Comm comm = CommunicatorLocal((*MG::GetRhs())(MG::GetRhs()->GlobalMaxLevel())); 449 450 bv_ranks.reserve(bvs.size()); 451 452 for (std::vector<BoundaryValue>::const_iterator iter_b = bvs.begin(); iter_b != bvs.end(); ++iter_b) { 453 for (std::map<Index, std::vector<GlobalIndices> >::const_iterator iter_g = global.begin(); iter_g != global.end(); ++iter_g) { 454 if (iter_b->GetIndex().IsComponentwiseGreaterOrEqual(iter_g->second[level_index].LocalBegin()) && 455 iter_b->GetIndex().IsComponentwiseLess(iter_g->second[level_index].LocalEnd())) { 456 bv_ranks.push_back(0); 457 coord = iter_g->first; 458 MPI_Cart_rank(comm, coord.vec(), &bv_ranks.back()); 459 break; 460 } 461 } 462 } 463 } 464 } 465 430 466 std::string VMG::MPI::Settings::ToString() const 431 467 { -
src/comm/mpi/settings.hpp
rd6a338 r177495 70 70 VMG::MPI::DatatypesLocal& DatatypesLocal(const Grid& grid); 71 71 72 const std::vector<int>& BoundaryRanks() const {return bv_ranks;} 73 72 74 std::string ToString() const; 73 75 … … 79 81 void CreateLocalCommunicator(MPI_Comm& comm_global, const Grid& grid); 80 82 83 void InitializeBoundaryValues(); 84 81 85 std::map<int, MPI_Comm> communicators_global; 82 86 std::map<KeyUnsorted, MPI_Comm> communicators_local; … … 86 90 std::map<KeyUnsorted, VMG::MPI::DatatypesGlobal> datatypes_global; 87 91 std::map<KeyUnsorted, VMG::MPI::DatatypesLocal> datatypes_local; 92 93 std::vector<int> bv_ranks; 94 88 95 }; 89 96
Note:
See TracChangeset
for help on using the changeset viewer.
