@@ -211,8 +211,8 @@ class BspArchitecture {
211211 */
212212 BspArchitecture ()
213213 : numberOfProcessors_(2U ), numberOfProcessorTypes_(1U ), communicationCosts_(1U ), synchronisationCosts_(2U ),
214- memoryBound_ (std::vector< v_memw_t <Graph_t>>( numberOfProcessors_, 100U ) ), isNuma_(false ),
215- processorTypes_(std::vector< unsigned >( numberOfProcessors_, 0U ) ), sendCosts_(numberOfProcessors_ * numberOfProcessors_, 1U ) {
214+ memoryBound_ (numberOfProcessors_, 100U ), isNuma_(false ),
215+ processorTypes_(numberOfProcessors_, 0U ), sendCosts_(numberOfProcessors_ * numberOfProcessors_, 1U ) {
216216 SetSendCostDiagonalToZero ();
217217 }
218218
@@ -235,8 +235,8 @@ class BspArchitecture {
235235 const v_memw_t <Graph_t> MemoryBound = 100U )
236236 : numberOfProcessors_(NumberOfProcessors), numberOfProcessorTypes_(1U ), communicationCosts_(CommunicationCost),
237237 synchronisationCosts_(SynchronisationCost),
238- memoryBound_(std::vector< v_memw_t <Graph_t>>( NumberOfProcessors, MemoryBound) ), isNuma_(false ),
239- processorTypes_(std::vector< unsigned >( NumberOfProcessors, 0U )) , sendCosts_(numberOfProcessors_ * numberOfProcessors_ , 1U ) {
238+ memoryBound_(NumberOfProcessors, MemoryBound), isNuma_(false ),
239+ processorTypes_(NumberOfProcessors, 0U ), sendCosts_(NumberOfProcessors * NumberOfProcessors , 1U ) {
240240 if (NumberOfProcessors == 0U ) {
241241 throw std::runtime_error (" BspArchitecture: Number of processors must be greater than 0." );
242242 }
@@ -277,8 +277,8 @@ class BspArchitecture {
277277 BspArchitecture (const unsigned NumberOfProcessors, const v_commw_t <Graph_t> CommunicationCost, const v_commw_t <Graph_t> SynchronisationCost,
278278 const std::vector<std::vector<v_commw_t <Graph_t>>> &SendCosts)
279279 : numberOfProcessors_(NumberOfProcessors), numberOfProcessorTypes_(1U ), communicationCosts_(CommunicationCost),
280- synchronisationCosts_(SynchronisationCost), memoryBound_(std::vector< v_memw_t <Graph_t>>( NumberOfProcessors, 100U ) ),
281- processorTypes_(std::vector< unsigned >( NumberOfProcessors, 0U ) ) {
280+ synchronisationCosts_(SynchronisationCost), memoryBound_(NumberOfProcessors, 100U ),
281+ processorTypes_(NumberOfProcessors, 0U ) {
282282 if (NumberOfProcessors == 0U ) {
283283 throw std::runtime_error (" BspArchitecture: Number of processors must be greater than 0." );
284284 }
@@ -311,9 +311,8 @@ class BspArchitecture {
311311 BspArchitecture (const unsigned NumberOfProcessors, const v_commw_t <Graph_t> CommunicationCost, const v_commw_t <Graph_t> SynchronisationCost,
312312 const v_memw_t <Graph_t> MemoryBound, const std::vector<std::vector<v_commw_t <Graph_t>>> &SendCosts)
313313 : numberOfProcessors_(NumberOfProcessors), numberOfProcessorTypes_(1U ), communicationCosts_(CommunicationCost),
314- synchronisationCosts_(SynchronisationCost),
315- memoryBound_(std::vector<v_memw_t <Graph_t>>(NumberOfProcessors, MemoryBound)),
316- processorTypes_(std::vector<unsigned >(NumberOfProcessors, 0U )) {
314+ synchronisationCosts_(SynchronisationCost), memoryBound_(NumberOfProcessors, MemoryBound),
315+ processorTypes_(NumberOfProcessors, 0U ) {
317316 if (NumberOfProcessors == 0U ) {
318317 throw std::runtime_error (" BspArchitecture: Number of processors must be greater than 0." );
319318 }
@@ -441,7 +440,7 @@ class BspArchitecture {
441440 * @param MemoryBound The new memory bound for all processors.
442441 */
443442 void setMemoryBound (const v_memw_t <Graph_t> MemoryBound) {
444- memoryBound_ = std::vector< v_memw_t <Graph_t>> (numberOfProcessors_, MemoryBound);
443+ memoryBound_. assign (numberOfProcessors_, MemoryBound);
445444 }
446445
447446 /* *
@@ -499,12 +498,12 @@ class BspArchitecture {
499498 }
500499 numberOfProcessors_ = numberOfProcessors;
501500 numberOfProcessorTypes_ = 1U ;
502- processorTypes_ = std::vector< unsigned > (numberOfProcessors_, 0U );
501+ processorTypes_. assign (numberOfProcessors_, 0U );
503502
504503 InitializeUniformSendCosts ();
505504
506505 // initialize memory bound to 100 for all processors
507- memoryBound_.resize (numberOfProcessors_, 100U );
506+ memoryBound_.assign (numberOfProcessors_, 100U );
508507 }
509508
510509 /* *
@@ -525,7 +524,7 @@ class BspArchitecture {
525524 InitializeUniformSendCosts ();
526525
527526 // initialize memory bound to 100 for all processors
528- memoryBound_.resize (numberOfProcessors_, 100U );
527+ memoryBound_.assign (numberOfProcessors_, 100U );
529528 UpdateNumberOfProcessorTypes ();
530529 }
531530
@@ -551,8 +550,8 @@ class BspArchitecture {
551550 numberOfProcessors_ = std::accumulate (processorTypeCount.begin (), processorTypeCount.end (), 0U );
552551
553552 // initialize processor types and memory bound
554- processorTypes_ = std::vector< v_type_t <Graph_t>> (numberOfProcessors_, 0U );
555- memoryBound_ = std::vector< v_memw_t <Graph_t>> (numberOfProcessors_, 0U );
553+ processorTypes_. assign (numberOfProcessors_, 0U );
554+ memoryBound_. assign (numberOfProcessors_, 0U );
556555
557556 unsigned offset = 0U ;
558557 for (unsigned i = 0U ; i < processorTypeCount.size (); i++) {
@@ -620,14 +619,14 @@ class BspArchitecture {
620619 [[nodiscard]] v_commw_t <Graph_t> synchronisationCosts () const { return synchronisationCosts_; }
621620
622621 /* *
623- * @brief Returns the send costs matrix.
622+ * @brief Returns a the send costs matrix. Internally the matrix is stored as a flattened matrix. The allocates, computes and returns the matrix on the fly .
624623 * @return The send costs matrix.
625624 */
626- [[nodiscard]] std::vector<std::vector<v_commw_t <Graph_t>>> sendCostMatrix () const {
625+ [[nodiscard]] std::vector<std::vector<v_commw_t <Graph_t>>> sendCost () const {
627626 std::vector<std::vector<v_commw_t <Graph_t>>> matrix (numberOfProcessors_, std::vector<v_commw_t <Graph_t>>(numberOfProcessors_));
628627 for (unsigned i = 0 ; i < numberOfProcessors_; ++i) {
629628 for (unsigned j = 0 ; j < numberOfProcessors_; ++j) {
630- matrix[i][j] = sendCosts_[ FlatIndex (i, j)] ;
629+ matrix[i][j] = sendCosts_. at ( FlatIndex (i, j)) ;
631630 }
632631 }
633632 return matrix;
@@ -666,12 +665,6 @@ class BspArchitecture {
666665 */
667666 [[nodiscard]] v_commw_t <Graph_t> sendCosts (const unsigned p1, const unsigned p2) const { return sendCosts_.at (FlatIndex (p1, p2)); }
668667
669- /* *
670- * @brief Returns the send costs matrix.
671- * @return The send costs matrix.
672- */
673- [[nodiscard]] std::vector<std::vector<v_commw_t <Graph_t>>> sendCosts () const { return sendCostMatrix (); }
674-
675668 /* *
676669 * @brief Returns the type of a specific processor.
677670 * @param p1 The processor index.
0 commit comments