13 #include <PanzerAdaptersSTK_config.hpp>
18 namespace panzer_stk {
33 PANZER_FUNC_TIME_MONITOR(
"panzer::LineMeshFactory::buildMesh()");
39 mesh->initialize(parallelMach);
49 PANZER_FUNC_TIME_MONITOR(
"panzer::LineMeshFactory::buildUncomittedMesh()");
53 machRank_ = stk::parallel_machine_rank(parallelMach);
54 machSize_ = stk::parallel_machine_size(parallelMach);
69 PANZER_FUNC_TIME_MONITOR(
"panzer::LineMeshFactory::completeMeshConstruction()");
95 x0_ = paramList->
get<
double>(
"X0");
96 xf_ = paramList->
get<
double>(
"Xf");
110 if(defaultParams == Teuchos::null) {
113 defaultParams->
set<
double>(
"X0",0.0);
114 defaultParams->
set<
double>(
"Xf",1.0);
115 defaultParams->
set<
int>(
"X Blocks",1);
116 defaultParams->
set<
int>(
"X Elements",5);
119 bcs.
set<
int>(
"Count",0);
122 return defaultParams;
136 typedef shards::Line<2> LineTopo;
137 const CellTopologyData * ctd = shards::getCellTopologyData<LineTopo>();
138 const CellTopologyData * side_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(0,0);
145 std::stringstream ebPostfix;
146 ebPostfix <<
"-" << bx;
162 for(
int xBlock=0;xBlock<
xBlocks_;xBlock++) {
173 int myXElems_start = sizeAndStartX.first;
174 int myXElems_end = myXElems_start+sizeAndStartX.second;
177 double deltaX = (
xf_-
x0_)/static_cast<double>(totalXElems);
180 std::vector<double> coord(1,0.0);
181 for(
int nx=myXElems_start;nx<myXElems_end+1;++nx) {
186 std::stringstream blockName;
187 blockName <<
"eblock-" << xBlock;
191 for(
int nx=myXElems_start;nx<myXElems_end;++nx) {
192 stk::mesh::EntityId gid = nx+1;
193 std::vector<stk::mesh::EntityId> nodes(2);
195 nodes[1] = nodes[0]+1;
205 unsigned int minElements =
nXElems_/size;
206 unsigned int extra =
nXElems_ - minElements*size;
214 nume = minElements+1;
215 start = xProcLoc*(minElements+1);
219 start = extra*(minElements+1)+(xProcLoc-extra)*minElements;
222 return std::make_pair(start+
nXElems_*xBlock,nume);
228 const stk::mesh::EntityRank sideRank = mesh.
getSideRank();
233 stk::mesh::Part * left = mesh.
getSideset(
"left");
234 stk::mesh::Part * right = mesh.
getSideset(
"right");
236 std::vector<stk::mesh::Entity> localElmts;
240 std::vector<stk::mesh::Entity>::const_iterator itr;
241 for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
242 stk::mesh::Entity element = (*itr);
245 std::size_t nx = gid-1;
250 if(nx+1==totalXElems) {
279 return Teuchos::tuple(i,j);
void buildMetaData(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
Teuchos::Tuple< std::size_t, 2 > procRankToProcTuple(std::size_t procRank) const
what is the 2D tuple describe this processor distribution
unsigned entityOwnerRank(stk::mesh::Entity entity) const
static void parsePeriodicBCList(const Teuchos::RCP< Teuchos::ParameterList > &pl, std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > &periodicBC, bool &useBBoxSearch)
T & get(const std::string &name, T def_value)
stk::mesh::Part * getElementBlockPart(const std::string &name) const
get the block part
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
Teuchos::Tuple< std::size_t, 2 > procTuple_
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual Teuchos::RCP< STK_Interface > buildUncommitedMesh(stk::ParallelMachine parallelMach) const
void buildBlock(stk::ParallelMachine machRank, int xBlock, STK_Interface &mesh) const
stk::mesh::Part * getSideset(const std::string &name) const
void addElement(const Teuchos::RCP< ElementDescriptor > &ed, stk::mesh::Part *block)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
stk::mesh::EntityRank getSideRank() const
void initialize(stk::ParallelMachine parallelMach, bool setupIO=true, const bool buildRefinementSupport=false)
Teuchos::RCP< STK_Interface > buildMesh(stk::ParallelMachine parallelMach) const
Build the mesh object.
void rebalance(STK_Interface &mesh) const
std::pair< int, int > determineXElemSizeAndStart(int xBlock, unsigned int size, unsigned int rank) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
From ParameterListAcceptor.
virtual void completeMeshConstruction(STK_Interface &mesh, stk::ParallelMachine parallelMach) const
stk::mesh::EntityId elementGlobalId(std::size_t lid) const
void setMyParamList(const RCP< ParameterList > ¶mList)
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
void addNode(stk::mesh::EntityId gid, const std::vector< double > &coord)
void buildSubcells()
force the mesh to build subcells: edges and faces
bool isInitialized() const
Has initialize been called on this mesh object?
stk::mesh::Entity findConnectivityById(stk::mesh::Entity src, stk::mesh::EntityRank tgt_rank, unsigned rel_id) const
void addSideset(const std::string &name, const CellTopologyData *ctData)
double getMeshCoord(const int nx, const double deltaX, const double x0) const
std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > periodicBCVec_
void buildElements(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
void buildLocalElementIDs()
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
#define TEUCHOS_ASSERT(assertion_test)
LineMeshFactory()
Constructor.
void addElementBlock(const std::string &name, const CellTopologyData *ctData)
void addSideSets(STK_Interface &mesh) const
~LineMeshFactory()
Destructor.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > ¶mList)
From ParameterListAcceptor.
void initializeWithDefaults()