43 #ifndef PANZER_BlockedDOF_MANAGER_FACTORY_IMPL_HPP 44 #define PANZER_BlockedDOF_MANAGER_FACTORY_IMPL_HPP 53 template <
typename LO,
typename GO>
57 std::vector<std::string> tokens;
66 if(tokens[0]!=
"blocked:")
70 bool acceptsHyphen =
false;
71 for(std::size_t i=1;i<tokens.size();i++) {
74 TEUCHOS_TEST_FOR_EXCEPTION(tokens[i]==
"-" && !acceptsHyphen,std::logic_error,
75 "Blocked assembly: Error \"Field Order\" hyphen error at " 78 if(acceptsHyphen && tokens[i]==
"-")
79 acceptsHyphen =
false;
88 template <
typename LO,
typename GO>
93 TEUCHOS_ASSERT(requiresBlocking(fieldOrder));
95 std::vector<std::string> tokens;
100 Teuchos::RCP<std::vector<std::string> > current;
101 for(std::size_t i=1;i<tokens.size();i++) {
103 if(tokens[i]!=
"-" && tokens[i-1]!=
"-") {
105 if(current!=Teuchos::null)
106 blocks.push_back(*current);
108 current = Teuchos::rcp(
new std::vector<std::string>);
112 current->push_back(tokens[i]);
115 if(current!=Teuchos::null)
116 blocks.push_back(*current);
119 template <
typename LO,
typename GO>
120 Teuchos::RCP<panzer::UniqueGlobalIndexer<LO,std::pair<int,GO> > >
122 const std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks,
124 const std::string & fieldOrder)
const 126 TEUCHOS_ASSERT(requiresBlocking(fieldOrder));
128 Teuchos::RCP<Teuchos::FancyOStream> pout = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
129 pout->setShowProcRank(
true);
130 pout->setOutputToRootOnly(0);
133 Teuchos::RCP<panzer::BlockedDOFManager<LO,GO> > dofManager
135 dofManager->enableTieBreak(useTieBreak_);
136 dofManager->setUseDOFManagerFEI(useDOFManagerFEI_);
139 bool orientationsRequired =
false;
141 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator physIter;
142 for(physIter=physicsBlocks.begin();physIter!=physicsBlocks.end();++physIter) {
143 Teuchos::RCP<const panzer::PhysicsBlock> pb = *physIter;
145 const std::vector<StrPureBasisPair> & blockFields = pb->getProvidedDOFs();
148 std::set<StrPureBasisPair,StrPureBasisComp> fieldNames;
149 fieldNames.insert(blockFields.begin(),blockFields.end());
152 std::set<StrPureBasisPair,StrPureBasisComp>::const_iterator fieldItr;
153 for (fieldItr=fieldNames.begin();fieldItr!=fieldNames.end();++fieldItr) {
155 orientationsRequired |= fieldItr->second->requiresOrientations();
157 Teuchos::RCP< Intrepid2::Basis<double,Kokkos::DynRankView<double,PHX::Device> > > intrepidBasis
158 = fieldItr->second->getIntrepid2Basis();
160 dofManager->addField(pb->elementBlockID(),fieldItr->first,fp);
165 dofManager->setOrientationsRequired(orientationsRequired);
167 std::vector<std::vector<std::string> > blocks;
168 buildBlocking(fieldOrder,blocks);
169 dofManager->setFieldOrder(blocks);
171 dofManager->buildGlobalUnknowns();
static void buildBlocking(const std::string &fieldorder, std::vector< std::vector< std::string > > &blocks)
PHX::MDField< ScalarT > vector
virtual Teuchos::RCP< panzer::UniqueGlobalIndexer< LO, std::pair< int, GO > > > buildUniqueGlobalIndexer(const Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > &mpiComm, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const Teuchos::RCP< ConnManager< LO, GO > > &connMngr, const std::string &fieldOrder="") const
void StringTokenizer(std::vector< std::string > &tokens, const std::string &str, const std::string delimiters, bool trim)
Tokenize a string, put tokens in a vector.
static bool requiresBlocking(const std::string &fieldorder)