Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_DOFManagerFactory.cpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef PANZER_DOF_MANAGER_FACTORY_IMPL_HPP
12#define PANZER_DOF_MANAGER_FACTORY_IMPL_HPP
13
14#include "Panzer_DOFManager.hpp"
18
20
21namespace panzer {
22
23Teuchos::RCP<panzer::GlobalIndexer>
24DOFManagerFactory::buildGlobalIndexer(const Teuchos::RCP<const Teuchos::OpaqueWrapper<MPI_Comm> > & mpiComm,
25 const std::vector<Teuchos::RCP<panzer::PhysicsBlock> > & physicsBlocks,
26 const Teuchos::RCP<ConnManager> & connMngr,
27 const std::string & fieldOrder) const
28{
29 PANZER_FUNC_TIME_MONITOR_DIFF("panzer::DOFManagerFactory::buildUnqueGlobalIndexer",BUGI);
30
31 Teuchos::RCP<Teuchos::FancyOStream> pout = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
32 pout->setShowProcRank(true);
33 pout->setOutputToRootOnly(0);
34
35 // build the DOF manager for the problem
36 Teuchos::RCP<panzer::DOFManager> dofManager
37 = Teuchos::rcp(new panzer::DOFManager(connMngr,*mpiComm));
38
39 dofManager->enableTieBreak(useTieBreak_);
40 dofManager->useNeighbors(useNeighbors_);
41
42 // by default assume orientations are not required
43 bool orientationsRequired = false;
44
45 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator physIter;
46 for(physIter=physicsBlocks.begin();physIter!=physicsBlocks.end();++physIter) {
47 Teuchos::RCP<const panzer::PhysicsBlock> pb = *physIter;
48
49 const std::vector<StrPureBasisPair> & blockFields = pb->getProvidedDOFs();
50
51 // insert all fields into a set
52 std::set<StrPureBasisPair,StrPureBasisComp> fieldNames;
53 fieldNames.insert(blockFields.begin(),blockFields.end());
54
55 // add basis to DOF manager: block specific
56 std::set<StrPureBasisPair,StrPureBasisComp>::const_iterator fieldItr;
57 for (fieldItr=fieldNames.begin();fieldItr!=fieldNames.end();++fieldItr) {
58 // determine if orientations are required
59 // PureBasis::EElementSpace space = fieldItr->second->getElementSpace();
60 // orientationsRequired |= ((space==PureBasis::HDIV) || (space==PureBasis::HCURL));
61 orientationsRequired |= fieldItr->second->requiresOrientations();
62
63 Teuchos::RCP< Intrepid2::Basis<PHX::Device::execution_space,double,double> > intrepidBasis
64 = fieldItr->second->getIntrepid2Basis();
65 Teuchos::RCP<Intrepid2FieldPattern> fp = Teuchos::rcp(new Intrepid2FieldPattern(intrepidBasis));
66 dofManager->addField(pb->elementBlockID(),fieldItr->first,fp);
67
68 // *pout << "\"" << fieldItr->first << "\" Field Pattern = \n";
69 // fp->print(*pout);
70 }
71 }
72
73 // set orientations required flag
74 dofManager->setOrientationsRequired(orientationsRequired);
75
76 if(fieldOrder!="") {
77 std::vector<std::string> fieldOrderV;
78 buildFieldOrder(fieldOrder,fieldOrderV);
79 dofManager->setFieldOrder(fieldOrderV);
80 }
81
82 {
83 PANZER_FUNC_TIME_MONITOR_DIFF("panzer::DOFManagerFactory::buildUnqueGlobalIndexer:buildGlobalUnknowns",BGU);
84 dofManager->buildGlobalUnknowns();
85 }
86
87 // dofManager->printFieldInformation(*pout);
88
89 // print out mesh topology information. Uncomment at your own risk, there will
90 // be A LOT of information printed to the screen (scaling with the number of elements)
91 // {
92 // Teuchos::FancyOStream out(Teuchos::rcpFromRef(std::cout));
93 // out.setShowProcRank(true);
94 // out.setOutputToRootOnly(-1);
95 // printMeshTopology(out,*dofManager);
96 // }
97
98 return dofManager;
99}
100
101void
103buildFieldOrder(const std::string & fieldOrderStr,std::vector<std::string> & fieldOrder)
104{
105 // this tokenizes "fieldOrderStr" string
106 // and dumps it into "fieldOrder"
107 std::stringstream ss;
108 ss << fieldOrderStr;
109
110 // until all tokens are eaten
111 while(!ss.eof()) {
112 std::string token;
113 ss >> token;
114
115 // reorder tokens
116 if(token!="")
117 fieldOrder.push_back(token);
118 }
119}
120
121}
122
123#endif
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
static void buildFieldOrder(const std::string &fieldOrderStr, std::vector< std::string > &fieldOrder)