@@ -151,12 +151,12 @@ class BspArchitecture {
151151 if (numberOfProcessors_ == 1U )
152152 return false ;
153153
154- const v_commw_t <Graph_t> val = sendCosts_. at ( 1U ) ;
154+ const v_commw_t <Graph_t> val = sendCosts_[ 1U ] ;
155155 for (unsigned p1 = 0U ; p1 < numberOfProcessors_; p1++) {
156156 for (unsigned p2 = 0U ; p2 < numberOfProcessors_; p2++) {
157157 if (p1 == p2)
158158 continue ;
159- if (sendCosts_. at ( FlatIndex (p1, p2)) != val)
159+ if (sendCosts_[ FlatIndex (p1, p2)] != val)
160160 return true ;
161161 }
162162 }
@@ -323,9 +323,9 @@ class BspArchitecture {
323323 for (unsigned i = 0U ; i < numberOfProcessors_; i++) {
324324 for (unsigned j = 0U ; j < numberOfProcessors_; j++) {
325325 if (i == j) {
326- sendCosts_. at ( FlatIndex (i, j)) = 0U ;
326+ sendCosts_[ FlatIndex (i, j)] = 0U ;
327327 } else {
328- sendCosts_. at ( FlatIndex (i, j)) = 1U ;
328+ sendCosts_[ FlatIndex (i, j)] = 1U ;
329329 }
330330 }
331331 }
@@ -353,7 +353,7 @@ class BspArchitecture {
353353 // Corrected loop to avoid underflow issues with unsigned
354354 for (int pos = static_cast <int >(maxPos); pos >= 0 ; --pos) {
355355 if (((1U << pos) & i) != ((1U << pos) & j)) {
356- sendCosts_. at ( FlatIndex (i, j)) = sendCosts_. at ( FlatIndex (j, i)) = intpow (base, static_cast <unsigned >(pos));
356+ sendCosts_[ FlatIndex (i, j)] = sendCosts_[ FlatIndex (j, i)] = intpow (base, static_cast <unsigned >(pos));
357357 break ;
358358 }
359359 }
@@ -441,12 +441,8 @@ class BspArchitecture {
441441 * @brief Sets the memory bound for a specific processor.
442442 * @param MemoryBound The new memory bound for the processor.
443443 * @param processorIndex The processor index. Must be less than numberOfProcessors_.
444- * @throws std::invalid_argument if the processor index is out of bounds.
445444 */
446445 void setMemoryBound (const v_memw_t <Graph_t> MemoryBound, const unsigned processorIndex) {
447- if (processorIndex >= numberOfProcessors_) {
448- throw std::invalid_argument (" Invalid Argument: Processor index out of bounds in setMemoryBound." );
449- }
450446 memoryBound_.at (processorIndex) = MemoryBound;
451447 }
452448
@@ -558,7 +554,7 @@ class BspArchitecture {
558554 * @param proc The processor index.
559555 * @return The memory bound.
560556 */
561- [[nodiscard]] v_memw_t <Graph_t> memoryBound (const unsigned proc) const { return memoryBound_. at ( proc) ; }
557+ [[nodiscard]] v_memw_t <Graph_t> memoryBound (const unsigned proc) const { return memoryBound_[ proc] ; }
562558
563559 /* *
564560 * @brief Returns the maximum memory bound over all processors.
@@ -575,8 +571,8 @@ class BspArchitecture {
575571 [[nodiscard]] v_memw_t <Graph_t> maxMemoryBoundProcType (const v_type_t <Graph_t> procType) const {
576572 v_memw_t <Graph_t> max_mem = 0U ;
577573 for (unsigned proc = 0U ; proc < numberOfProcessors_; proc++) {
578- if (processorTypes_. at ( proc) == procType) {
579- max_mem = std::max (max_mem, memoryBound_. at ( proc) );
574+ if (processorTypes_[ proc] == procType) {
575+ max_mem = std::max (max_mem, memoryBound_[ proc] );
580576 }
581577 }
582578 return max_mem;
@@ -608,7 +604,7 @@ class BspArchitecture {
608604 std::vector<std::vector<v_commw_t <Graph_t>>> matrix (numberOfProcessors_, std::vector<v_commw_t <Graph_t>>(numberOfProcessors_));
609605 for (unsigned i = 0 ; i < numberOfProcessors_; ++i) {
610606 for (unsigned j = 0 ; j < numberOfProcessors_; ++j) {
611- matrix[i][j] = sendCosts_. at ( FlatIndex (i, j)) ;
607+ matrix[i][j] = sendCosts_[ FlatIndex (i, j)] ;
612608 }
613609 }
614610 return matrix;
@@ -627,42 +623,39 @@ class BspArchitecture {
627623 [[nodiscard]] const std::vector<unsigned > &processorTypes () const { return processorTypes_; }
628624
629625 /* *
630- * @brief Returns the communication costs between two processors.
626+ * @brief Returns the communication costs between two processors. Does not perform bounds checking.
631627 * The communication costs are the send costs multiplied by the communication costs factor.
632628 *
633629 * @param p1 The index of the first processor.
634630 * @param p2 The index of the second processor.
635631 * @return The communication costs between the two processors.
636632 */
637633 [[nodiscard]] v_commw_t <Graph_t> communicationCosts (const unsigned p1, const unsigned p2) const {
638- return communicationCosts_ * sendCosts_. at ( FlatIndex (p1, p2)) ;
634+ return communicationCosts_ * sendCosts_[ FlatIndex (p1, p2)] ;
639635 }
640636
641637 /* *
642- * @brief Returns the send costs between two processors.
638+ * @brief Returns the send costs between two processors. Does not perform bounds checking.
643639 *
644640 * @param p1 The index of the first processor.
645641 * @param p2 The index of the second processor.
646642 * @return The send costs between the two processors.
647643 */
648- [[nodiscard]] v_commw_t <Graph_t> sendCosts (const unsigned p1, const unsigned p2) const { return sendCosts_. at ( FlatIndex (p1, p2)) ; }
644+ [[nodiscard]] v_commw_t <Graph_t> sendCosts (const unsigned p1, const unsigned p2) const { return sendCosts_[ FlatIndex (p1, p2)] ; }
649645
650646 /* *
651- * @brief Returns the type of a specific processor.
647+ * @brief Returns the type of a specific processor. Does not perform bounds checking.
652648 * @param p1 The processor index.
653649 * @return The processor type.
654650 */
655- [[nodiscard]] v_type_t <Graph_t> processorType (const unsigned p1) const { return processorTypes_. at (p1) ; }
651+ [[nodiscard]] v_type_t <Graph_t> processorType (const unsigned p1) const { return processorTypes_[p1] ; }
656652
657653 /* *
658- * @brief Sets the type of a specific processor.
654+ * @brief Sets the type of a specific processor. Performs bounds checking.
659655 * @param p1 The processor index.
660656 * @param type The new processor type.
661657 */
662658 void setProcessorType (const unsigned p1, const v_type_t <Graph_t> type) {
663- if (p1 >= numberOfProcessors_)
664- throw std::invalid_argument (" Invalid Argument: Processor index out of bounds." );
665-
666659 processorTypes_.at (p1) = type;
667660 numberOfProcessorTypes_ = std::max (numberOfProcessorTypes_, type + 1U );
668661 }
@@ -674,7 +667,7 @@ class BspArchitecture {
674667 [[nodiscard]] std::vector<unsigned > getProcessorTypeCount () const {
675668 std::vector<unsigned > type_count (numberOfProcessorTypes_, 0U );
676669 for (unsigned p = 0U ; p < numberOfProcessors_; p++) {
677- type_count[processorTypes_. at (p) ]++;
670+ type_count[processorTypes_[p] ]++;
678671 }
679672 return type_count;
680673 }
0 commit comments