11 #include "PanzerDofMgr_config.hpp"
13 #ifdef PANZER_HAVE_EPETRA
25 std::vector<panzer::GlobalOrdinal> indices;
26 std::vector<std::string> blocks;
28 ugi.getOwnedAndGhostedIndices(indices);
29 ugi.getElementBlockIds(blocks);
31 std::vector<int> fieldNumbers(indices.size(),-1);
35 if (mpiComm != Teuchos::null)
39 =
Teuchos::rcp(
new Map(-1, static_cast<int>(indices.size()), Teuchos::arrayViewFromVector(indices).getRawPtr(),
43 for(std::size_t blk=0;blk<blocks.size();blk++) {
44 std::string blockId = blocks[blk];
46 const std::vector<panzer::LocalOrdinal> & elements = ugi.getElementBlock(blockId);
47 const std::vector<int> & fields = ugi.getBlockFieldNumbers(blockId);
50 std::vector<panzer::GlobalOrdinal> gids(fields.size());
51 for(std::size_t e=0;e<elements.size();e++) {
52 ugi.getElementGIDs(elements[e],gids);
54 for(std::size_t f=0;f<fields.size();f++) {
55 int fieldNum = fields[f];
56 panzer::GlobalOrdinal gid = gids[f];
57 std::size_t lid = ghostedMap->LID(gid);
59 fieldNumbers[lid] = fieldNum;
65 std::vector<panzer::GlobalOrdinal> reducedIndices;
66 std::vector<int> reducedFieldNumbers;
67 for(std::size_t i=0;i<fieldNumbers.size();i++) {
68 if(fieldNumbers[i]>-1) {
69 reducedIndices.push_back(indices[i]);
70 reducedFieldNumbers.push_back(fieldNumbers[i]);
75 =
Teuchos::rcp(
new Map(-1, static_cast<int>(reducedIndices.size()), Teuchos::arrayViewFromVector(reducedIndices).getRawPtr(),
77 return Teuchos::rcp(
new IntVector(Copy,*reducedMap,Teuchos::arrayViewFromVector(reducedFieldNumbers).getRawPtr()));
81 std::vector<int> & fieldNumbers,
88 fieldNumbers.resize(dest->MyLength());
107 std::vector<panzer::GlobalOrdinal> indices;
108 ugi.getOwnedAndGhostedIndices(indices);
112 if (mpiComm != Teuchos::null)
115 destMap =
Teuchos::rcp(
new Map(-1, static_cast<int>(indices.size()), Teuchos::arrayViewFromVector(indices).getRawPtr(),
120 if(source==Teuchos::null)
129 Importer importer(*destMap,*sourceMap);
131 dest->Import(*source,importer,Insert);
147 std::vector<panzer::GlobalOrdinal> indices;
148 ugi_->getOwnedIndices(indices);
152 if (mpiComm != Teuchos::null)
157 Teuchos::arrayViewFromVector(indices).getRawPtr(),
164 localFieldVector->Import(source,importer,Insert);
193 std::vector<int> fieldVector(fieldTVector.
MyLength());
197 std::vector<int> mapVector;
198 for(std::size_t i=0;i<fieldVector.size();i++) {
199 if(fieldVector[i]==fieldNum)
200 mapVector.push_back(origMap->
GID(i));
211 #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)