43 #ifndef PANZER_BlockedDOF_MANAGER_FACTORY_IMPL_HPP 44 #define PANZER_BlockedDOF_MANAGER_FACTORY_IMPL_HPP 58 std::vector<std::string> tokens;
67 if(tokens[0]!=
"blocked:")
71 bool acceptsHyphen =
false;
72 for(std::size_t i=1;i<tokens.size();i++) {
75 TEUCHOS_TEST_FOR_EXCEPTION(tokens[i]==
"-" && !acceptsHyphen,std::logic_error,
76 "Blocked assembly: Error \"Field Order\" hyphen error at " 79 if(acceptsHyphen && tokens[i]==
"-")
80 acceptsHyphen =
false;
90 buildBlocking(
const std::string & fieldOrder,std::vector<std::vector<std::string> > & blocks)
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 Teuchos::RCP<panzer::GlobalIndexer>
121 const std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks,
122 const Teuchos::RCP<ConnManager> & connMngr,
123 const std::string & fieldOrder)
const 127 Teuchos::RCP<Teuchos::FancyOStream> pout = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
128 pout->setShowProcRank(
true);
129 pout->setOutputToRootOnly(0);
132 Teuchos::RCP<panzer::BlockedDOFManager> dofManager
138 bool orientationsRequired =
false;
140 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator physIter;
141 for(physIter=physicsBlocks.begin();physIter!=physicsBlocks.end();++physIter) {
142 Teuchos::RCP<const panzer::PhysicsBlock> pb = *physIter;
144 const std::vector<StrPureBasisPair> & blockFields = pb->getProvidedDOFs();
147 std::set<StrPureBasisPair,StrPureBasisComp> fieldNames;
148 fieldNames.insert(blockFields.begin(),blockFields.end());
151 std::set<StrPureBasisPair,StrPureBasisComp>::const_iterator fieldItr;
152 for (fieldItr=fieldNames.begin();fieldItr!=fieldNames.end();++fieldItr) {
154 orientationsRequired |= fieldItr->second->requiresOrientations();
156 Teuchos::RCP< Intrepid2::Basis<PHX::Device::execution_space,double,double> > intrepidBasis
157 = fieldItr->second->getIntrepid2Basis();
159 dofManager->addField(pb->elementBlockID(),fieldItr->first,fp);
164 dofManager->setOrientationsRequired(orientationsRequired);
166 std::vector<std::vector<std::string> > blocks;
168 dofManager->setFieldOrder(blocks);
170 dofManager->buildGlobalUnknowns();
static bool requiresBlocking(const std::string &fieldorder)
static void buildBlocking(const std::string &fieldorder, std::vector< std::vector< std::string > > &blocks)
virtual Teuchos::RCP< panzer::GlobalIndexer > buildGlobalIndexer(const Teuchos::RCP< const Teuchos::OpaqueWrapper< MPI_Comm > > &mpiComm, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const Teuchos::RCP< ConnManager > &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.