48 namespace panzer_stk {
67 mesh->initialize(parallelMach);
79 machRank_ = stk::parallel_machine_rank(parallelMach);
80 machSize_ = stk::parallel_machine_size(parallelMach);
118 if(defaultParams == Teuchos::null) {
121 defaultParams->
set<
int>(
"X Elements",2);
122 defaultParams->
set<
int>(
"Y Elements",2);
125 return defaultParams;
136 typedef shards::Quadrilateral<4> QuadTopo;
137 const CellTopologyData * ctd = shards::getCellTopologyData<QuadTopo>();
138 const CellTopologyData * side_ctd = shards::CellTopology(ctd).getBaseCellTopologyData(1,0);
142 for(
int bx=0;bx<2;bx++) {
144 std::stringstream ebPostfix;
145 ebPostfix <<
"-" <<
"0_" << bx;
175 int myXElems_start = (
machRank_==0 ? 0 : 2);
176 int myXElems_end = (
machRank_==0 ? 1 : 3);
177 int myYElems_start = 0;
178 int myYElems_end = 1;
186 double deltaX = (xf_-x0_)/
double(totalXElems);
187 double deltaY = (yf_-y0_)/
double(totalYElems);
189 std::vector<double> coord(2,0.0);
192 for(
int nx=myXElems_start;nx<myXElems_end+1;++nx) {
193 coord[0] = double(nx)*deltaX+x0_;
194 for(
int ny=myYElems_start;ny<myYElems_end+1;++ny) {
195 coord[1] = double(ny)*deltaY+y0_;
197 mesh.
addNode(ny*(totalXElems+1)+nx+1,coord);
201 std::stringstream blockName;
202 blockName <<
"eblock-" << xBlock <<
"_" << yBlock;
206 for(
int nx=myXElems_start;nx<myXElems_end;++nx) {
207 for(
int ny=myYElems_start;ny<myYElems_end;++ny) {
208 stk::mesh::EntityId gid = totalXElems*ny+nx+1;
209 std::vector<stk::mesh::EntityId> nodes(4);
210 nodes[0] = nx+1+ny*(totalXElems+1);
211 nodes[1] = nodes[0]+1;
212 nodes[2] = nodes[1]+(totalXElems+1);
213 nodes[3] = nodes[2]-1;
223 unsigned int minElements =
nXElems_/size;
224 unsigned int extra =
nXElems_ - minElements*size;
232 nume = minElements+1;
233 start = rank*(minElements+1);
237 start = extra*(minElements+1)+(rank-extra)*minElements;
240 return std::make_pair(start+
nXElems_*xBlock,nume);
247 return std::make_pair(start,nYElems_);
254 std::size_t totalXElems =
nXElems_*2;
255 std::size_t totalYElems =
nYElems_*1;
258 stk::mesh::Part * left = mesh.
getSideset(
"left");
259 stk::mesh::Part * right = mesh.
getSideset(
"right");
260 stk::mesh::Part * top = mesh.
getSideset(
"top");
261 stk::mesh::Part * bottom = mesh.
getSideset(
"bottom");
263 std::vector<stk::mesh::Entity> localElmts;
267 std::vector<stk::mesh::Entity>::const_iterator itr;
268 for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
269 stk::mesh::Entity element = (*itr);
273 ny = (gid-1) / totalXElems;
274 nx = gid-ny*totalXElems-1;
279 if(nx+1==totalXElems) {
306 if(ny+1==totalYElems) {
virtual Teuchos::RCP< STK_Interface > buildUncommitedMesh(stk::ParallelMachine parallelMach) const
unsigned entityOwnerRank(stk::mesh::Entity entity) const
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)
~MultiBlockMeshFactory()
Destructor.
void addEntityToSideset(stk::mesh::Entity entity, stk::mesh::Part *sideset)
void addSideSets(STK_Interface &mesh) const
stk::mesh::Part * getSideset(const std::string &name) const
void buildBlock(stk::ParallelMachine parallelMach, int xBlock, int yBlock, STK_Interface &mesh) 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)
void initialize(stk::ParallelMachine parallelMach, bool setupIO=true, const bool buildRefinementSupport=false)
void rebalance(STK_Interface &mesh) const
stk::mesh::EntityId elementGlobalId(std::size_t lid) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
From ParameterListAcceptor.
Teuchos::RCP< STK_Interface > buildMesh(stk::ParallelMachine parallelMach) const
Build the mesh object.
MultiBlockMeshFactory()
Constructor.
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?
void buildElements(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
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)
void initializeWithDefaults()
void buildLocalElementIDs()
std::pair< int, int > determineYElemSizeAndStart(int yBlock, unsigned int size, unsigned int rank) const
std::pair< int, int > determineXElemSizeAndStart(int xBlock, unsigned int size, unsigned int rank) const
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > ¶mList)
From ParameterListAcceptor.
virtual void completeMeshConstruction(STK_Interface &mesh, stk::ParallelMachine parallelMach) const
void getMyElements(std::vector< stk::mesh::Entity > &elements) const
#define TEUCHOS_ASSERT(assertion_test)
void buildMetaData(stk::ParallelMachine parallelMach, STK_Interface &mesh) const
void addElementBlock(const std::string &name, const CellTopologyData *ctData)