43 #ifndef PANZER_BlockedDOF_MANAGER_FACTORY_IMPL_HPP 44 #define PANZER_BlockedDOF_MANAGER_FACTORY_IMPL_HPP 54 template <
typename LO,
typename GO>
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;
89 template <
typename LO,
typename GO>
91 buildBlocking(
const std::string & fieldOrder,std::vector<std::vector<std::string> > & blocks)
94 TEUCHOS_ASSERT(requiresBlocking(fieldOrder));
96 std::vector<std::string> tokens;
101 Teuchos::RCP<std::vector<std::string> > current;
102 for(std::size_t i=1;i<tokens.size();i++) {
104 if(tokens[i]!=
"-" && tokens[i-1]!=
"-") {
106 if(current!=Teuchos::null)
107 blocks.push_back(*current);
109 current = Teuchos::rcp(
new std::vector<std::string>);
113 current->push_back(tokens[i]);
116 if(current!=Teuchos::null)
117 blocks.push_back(*current);
120 template <
typename LO,
typename GO>
121 Teuchos::RCP<panzer::UniqueGlobalIndexer<LO,std::pair<int,GO> > >
123 const std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks,
125 const std::string & fieldOrder)
const 127 TEUCHOS_ASSERT(requiresBlocking(fieldOrder));
129 Teuchos::RCP<Teuchos::FancyOStream> pout = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
130 pout->setShowProcRank(
true);
131 pout->setOutputToRootOnly(0);
134 Teuchos::RCP<panzer::BlockedDOFManager<LO,GO> > dofManager
136 dofManager->enableTieBreak(useTieBreak_);
137 dofManager->setUseDOFManagerFEI(useDOFManagerFEI_);
140 bool orientationsRequired =
false;
142 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator physIter;
143 for(physIter=physicsBlocks.begin();physIter!=physicsBlocks.end();++physIter) {
144 Teuchos::RCP<const panzer::PhysicsBlock> pb = *physIter;
146 const std::vector<StrPureBasisPair> & blockFields = pb->getProvidedDOFs();
149 std::set<StrPureBasisPair,StrPureBasisComp> fieldNames;
150 fieldNames.insert(blockFields.begin(),blockFields.end());
153 std::set<StrPureBasisPair,StrPureBasisComp>::const_iterator fieldItr;
154 for (fieldItr=fieldNames.begin();fieldItr!=fieldNames.end();++fieldItr) {
156 orientationsRequired |= fieldItr->second->requiresOrientations();
158 Teuchos::RCP< Intrepid2::Basis<PHX::Device::execution_space,double,double> > intrepidBasis
159 = fieldItr->second->getIntrepid2Basis();
161 dofManager->addField(pb->elementBlockID(),fieldItr->first,fp);
166 dofManager->setOrientationsRequired(orientationsRequired);
168 std::vector<std::vector<std::string> > blocks;
169 buildBlocking(fieldOrder,blocks);
170 dofManager->setFieldOrder(blocks);
172 dofManager->buildGlobalUnknowns();
static void buildBlocking(const std::string &fieldorder, std::vector< std::vector< std::string > > &blocks)
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)