70 globalOffset += blockMap_[i]->getMaxAllGlobalIndex() + 1;
73 CommConstPtr_Type comm = blockMap_[0]->getComm();
74 typedef Teuchos::OrdinalTraits<GO> GOOT;
76 mergedMap_ = Teuchos::rcp(
new Map_Type( GOOT::invalid(), globalElementList(), GOST::zero(), comm ) );
80template <
class LO,
class GO,
class NO>
81void BlockMap<LO,GO,NO>::print( ){
82 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_.size()==0, std::logic_error,
"BlockMap has no maps - nothing to print.");
83 std::cout <<
" --- Blockmap size: " << blockMap_.size() <<
" --- " << std::endl;
84 for (UN i=0; i<blockMap_.size(); i++) {
85 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_[i].is_null(), std::runtime_error,
"Map in BlockMap is null. This should not happen.");
86 blockMap_[i]->print();
91template <
class LO,
class GO,
class NO>
92void BlockMap<LO,GO,NO>::info( ){
93 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_.size()==0, std::logic_error,
"BlockMap has no maps - nothing to inform.");
94 if(blockMap_[0]->getComm()->getRank() == 0){
95 std::cout <<
" ------------------------------------------------- " << std::endl;
96 std::cout <<
" --- Blockmap size: " << blockMap_.size() <<
" --- " << std::endl;
97 for (UN i=0; i<blockMap_.size(); i++) {
98 std::cout <<
" ------------------------------------------------- " << std::endl;
99 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_[i].is_null(), std::runtime_error,
"Map in BlockMap is null. This should not happen.");
100 std::cout <<
" Block Map i=" << i << std::endl;
101 std::cout <<
" Global number of elements " << blockMap_[i]->getGlobalNumElements() << std::endl;
102 std::cout <<
" Maximum index " << blockMap_[i]->getMaxAllGlobalIndex() << std::endl;
103 std::cout <<
" ------------------------------------------------- " << std::endl;
106 std::cout <<
" ------------------------------------------------- " << std::endl;
112template <
class LO,
class GO,
class NO>
113std::string BlockMap<LO,GO,NO>::getUnderlyingLib( )
const{
114 TEUCHOS_TEST_FOR_EXCEPTION(blockMap_.size()==0,std::runtime_error,
"BlockMap size is 0, there is no underlying Lib.");
115 TEUCHOS_TEST_FOR_EXCEPTION(blockMap_[0].is_null(),std::runtime_error,
"BlockMap[0] is null.");
116 return blockMap_[0]->getUnderlyingLib();
119template <
class LO,
class GO,
class NO>
121 if ( mergedMap_.is_null() )
126template <
class LO,
class GO,
class NO>
128 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_.size()==0, std::logic_error,
"BlockMap has no maps - no Comm available.");
129 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_[0].is_null(), std::logic_error,
"BlockMap[0] is null.");
130 return blockMap_[0]->getComm();
133template <
class LO,
class GO,
class NO>
134typename BlockMap<LO,GO,NO>::CommPtr_Type BlockMap<LO,GO,NO>::getCommNonConst(){
135 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_.size()==0, std::logic_error,
"BlockMap has no maps - no Comm available.");
136 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_[0].is_null(), std::logic_error,
"BlockMap[0] is null.");
137 return blockMap_[0]->getCommNonConst();
140template <
class LO,
class GO,
class NO>
141typename BlockMap<LO,GO,NO>::MapPtr_Type BlockMap<LO,GO,NO>::getBlock(UN i){
142 TEUCHOS_TEST_FOR_EXCEPTION( i > blockMap_.size()-1, std::logic_error,
"BlockMap entry does not exist.");
143 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_[i].is_null(), std::logic_error,
"Map in BlockMap entry is null.");
147template <
class LO,
class GO,
class NO>
148typename BlockMap<LO,GO,NO>::MapConstPtr_Type BlockMap<LO,GO,NO>::getBlock(UN i)
const{
149 TEUCHOS_TEST_FOR_EXCEPTION( i > blockMap_.size()-1, std::logic_error,
"BlockMap entry does not exist.");
150 TEUCHOS_TEST_FOR_EXCEPTION( blockMap_[i].is_null(), std::logic_error,
"Map in BlockMap entry is null.");