43 #include "PanzerDofMgr_config.hpp"
45 #ifdef PANZER_HAVE_EPETRA
57 std::vector<panzer::GlobalOrdinal> indices;
58 std::vector<std::string> blocks;
60 ugi.getOwnedAndGhostedIndices(indices);
61 ugi.getElementBlockIds(blocks);
63 std::vector<int> fieldNumbers(indices.size(),-1);
67 if (mpiComm != Teuchos::null)
71 =
Teuchos::rcp(
new Map(-1, static_cast<int>(indices.size()), Teuchos::arrayViewFromVector(indices).getRawPtr(),
75 for(std::size_t blk=0;blk<blocks.size();blk++) {
76 std::string blockId = blocks[blk];
78 const std::vector<panzer::LocalOrdinal> & elements = ugi.getElementBlock(blockId);
79 const std::vector<int> & fields = ugi.getBlockFieldNumbers(blockId);
82 std::vector<panzer::GlobalOrdinal> gids(fields.size());
83 for(std::size_t e=0;e<elements.size();e++) {
84 ugi.getElementGIDs(elements[e],gids);
86 for(std::size_t f=0;f<fields.size();f++) {
87 int fieldNum = fields[f];
88 panzer::GlobalOrdinal gid = gids[f];
89 std::size_t lid = ghostedMap->LID(gid);
91 fieldNumbers[lid] = fieldNum;
97 std::vector<panzer::GlobalOrdinal> reducedIndices;
98 std::vector<int> reducedFieldNumbers;
99 for(std::size_t i=0;i<fieldNumbers.size();i++) {
100 if(fieldNumbers[i]>-1) {
101 reducedIndices.push_back(indices[i]);
102 reducedFieldNumbers.push_back(fieldNumbers[i]);
107 =
Teuchos::rcp(
new Map(-1, static_cast<int>(reducedIndices.size()), Teuchos::arrayViewFromVector(reducedIndices).getRawPtr(),
109 return Teuchos::rcp(
new IntVector(Copy,*reducedMap,Teuchos::arrayViewFromVector(reducedFieldNumbers).getRawPtr()));
113 std::vector<int> & fieldNumbers,
120 fieldNumbers.resize(dest->MyLength());
139 std::vector<panzer::GlobalOrdinal> indices;
140 ugi.getOwnedAndGhostedIndices(indices);
144 if (mpiComm != Teuchos::null)
147 destMap =
Teuchos::rcp(
new Map(-1, static_cast<int>(indices.size()), Teuchos::arrayViewFromVector(indices).getRawPtr(),
152 if(source==Teuchos::null)
161 Importer importer(*destMap,*sourceMap);
163 dest->Import(*source,importer,Insert);
179 std::vector<panzer::GlobalOrdinal> indices;
180 ugi_->getOwnedIndices(indices);
184 if (mpiComm != Teuchos::null)
189 Teuchos::arrayViewFromVector(indices).getRawPtr(),
196 localFieldVector->Import(source,importer,Insert);
225 std::vector<int> fieldVector(fieldTVector.
MyLength());
229 std::vector<int> mapVector;
230 for(std::size_t i=0;i<fieldVector.size();i++) {
231 if(fieldVector[i]==fieldNum)
232 mapVector.push_back(origMap->
GID(i));
243 #endif //end PANZER_HAVE_EPETRA
std::map< int, Teuchos::RCP< const Map > > fieldMaps_
(unghosted) field vector (as needed)
Teuchos::RCP< Epetra_IntVector > buildGhostedFieldReducedVectorEpetra(const GlobalIndexer &ugi)
Teuchos::RCP< const IntVector > fieldVector_
Maps for each field (as needed)
Teuchos::RCP< const Epetra_IntVector > buildGhostedFieldVectorEpetra(const GlobalIndexer &ugi, const Teuchos::RCP< const Epetra_IntVector > &reducedVec=Teuchos::null)
int ExtractCopy(int *V) const
Teuchos::RCP< const Epetra_Map > getFieldMap(const std::string &fieldName) const
void buildFieldVector(const Epetra_IntVector &source) const
build unghosted field vector from ghosted field vector
Teuchos::RCP< const IntVector > gh_fieldVector_
ghosted reduced field vector
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Epetra_IntVector IntVector
const Epetra_Comm & Comm() const
Teuchos::RCP< const GlobalIndexer > ugi_
DOF mapping.
Teuchos::RCP< const Epetra_BlockMap > getFieldMapEpetra(int fieldNum, const Epetra_IntVector &fieldVector)
ArrayToFieldVectorEpetra()
Maps for each field (as needed)