45 #include <PanzerAdaptersSTK_config.hpp>
50 namespace panzer_stk {
65 PANZER_FUNC_TIME_MONITOR(
"panzer::LineMeshFactory::buildMesh()");
71 mesh->initialize(parallelMach);
81 PANZER_FUNC_TIME_MONITOR(
"panzer::LineMeshFactory::buildUncomittedMesh()");
85 machRank_ = stk::parallel_machine_rank(parallelMach);
86 machSize_ = stk::parallel_machine_size(parallelMach);
100 PANZER_FUNC_TIME_MONITOR(
"panzer::LineMeshFactory::completeMeshConstruction()");
126 x0_ = paramList->
get<
double>(
"X0");
127 xf_ = paramList->
get<
double>(
"Xf");
141 if(defaultParams == Teuchos::null) {
144 defaultParams->
set<
double>(
"X0",0.0);
145 defaultParams->
set<
double>(
"Xf",1.0);
146 defaultParams->
set<
int>(
"X Blocks",1);
147 defaultParams->
set<
int>(
"X Elements",5);
150 bcs.
set<
int>(
"Count",0);
153 return defaultParams;
167 typedef shards::Line<2> LineTopo;
168 const CellTopologyData * ctd = shards::getCellTopologyData<LineTopo>();
169 const CellTopologyData * side_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(0,0);
176 std::stringstream ebPostfix;
177 ebPostfix <<
"-" << bx;
193 for(
int xBlock=0;xBlock<
xBlocks_;xBlock++) {
204 int myXElems_start = sizeAndStartX.first;
205 int myXElems_end = myXElems_start+sizeAndStartX.second;
208 double deltaX = (
xf_-
x0_)/static_cast<double>(totalXElems);
211 std::vector<double> coord(1,0.0);
212 for(
int nx=myXElems_start;nx<myXElems_end+1;++nx) {
217 std::stringstream blockName;
218 blockName <<
"eblock-" << xBlock;
222 for(
int nx=myXElems_start;nx<myXElems_end;++nx) {
223 stk::mesh::EntityId gid = nx+1;
224 std::vector<stk::mesh::EntityId> nodes(2);
226 nodes[1] = nodes[0]+1;
236 unsigned int minElements =
nXElems_/size;
237 unsigned int extra =
nXElems_ - minElements*size;
245 nume = minElements+1;
246 start = xProcLoc*(minElements+1);
250 start = extra*(minElements+1)+(xProcLoc-extra)*minElements;
253 return std::make_pair(start+
nXElems_*xBlock,nume);
259 const stk::mesh::EntityRank sideRank = mesh.
getSideRank();
264 stk::mesh::Part * left = mesh.
getSideset(
"left");
265 stk::mesh::Part * right = mesh.
getSideset(
"right");
267 std::vector<stk::mesh::Entity> localElmts;
271 std::vector<stk::mesh::Entity>::const_iterator itr;
272 for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
273 stk::mesh::Entity element = (*itr);
276 std::size_t nx = gid-1;
281 if(nx+1==totalXElems) {
310 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
T & get(const std::string &name, T def_value)
stk::mesh::Part * getElementBlockPart(const std::string &name) const
get the block count
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
Teuchos::Tuple< std::size_t, 2 > procTuple_
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.
static void parsePeriodicBCList(const Teuchos::RCP< Teuchos::ParameterList > &pl, std::vector< Teuchos::RCP< const PeriodicBC_MatcherBase > > &periodicBC)
void initializeWithDefaults()