6 #ifndef TPZGEOELREFPATTERN_H 7 #define TPZGEOELREFPATTERN_H 16 static LoggerPtr loggerrefpattern(Logger::getLogger(
"pz.mesh.tpzgeoelrefpattern"));
22 template<
class T,
int N>
59 return fSubEl.
NElements() && fSubEl[0]!=-1;
91 virtual int FatherSide(
int side,
int son)
override;
107 virtual void Print(std::ostream & out)
override;
126 std::map<int64_t,int64_t> &gl2lcNdIdx,
127 std::map<int64_t,int64_t> &gl2lcElIdx)
const override;
141 std::map<int64_t,int64_t> &gl2lcNdIdx,
142 std::map<int64_t,int64_t> &gl2lcElIdx );
146 template <
class TGeo>
163 PZError <<
"Error at " << __PRETTY_FUNCTION__ <<
" at line " << __LINE__ <<
" - this->GetRefPattern() is NULL\n";
167 if (id<0 || id >nsubel){
168 PZError <<
"TPZGeoElRefPattern::Trying do define subelement :" <<
id << std::endl;
184 return TGeo::RefElVolume();
191 if(side<0 || side>this->
NSides()-1) {
192 PZError <<
"TPZGeoElRefPattern::MidSideNodeIndex. Bad parameter side = " << side << std::endl;
211 subels[0].Element()->MidSideNodeIndex(subels[0].Side(),index);
218 int64_t subnodeindex;
219 for (i=0;i<nsubel;i++){
220 if(subels[i].Side() >= subels[i].Element()->
NCornerNodes())
continue;
221 subnodeindex = subels[i].SideNodeIndex(0);
222 msnindex.
Push(subnodeindex);
225 std::cout <<
"TPZGeoElRefPattern<TGeo>::MidSideNodeIndex element with more than one midsidenodeindex..." << std::endl;
227 if (msnindex.
NElements() == 1) index = msnindex[0];
234 this->
X(auxpt,centerpt);
241 aux += (this->
Mesh()->
NodeVec()[msnindex[i]].Coord(j) - centerpt[j]) *
242 (this->
Mesh()->
NodeVec()[msnindex[i]].Coord(j) - centerpt[j]);
266 int64_t noFather = -1;
287 if(is<0 || is>= nsubel){
288 std::cout <<
"TPZGeoElRefPattern::SubElement index error is= " << is << std::endl;
301 PZError <<
"TPZGeoElRefPattern<TGeo>::SideSubElement : Error subelement not found for side " 302 << side <<
" position " << position << std::endl;
327 while(neighbour.
Exists() && neighbour != thisside)
331 if (father == reffather)
333 int64_t sonid = neighbour.
Element()->
Id()-1;
334 int sonside = neighbour.
Side();
347 for(int64_t el = 0; el < size; el++)
349 int64_t subelIndex = sideIndexes[el].ElementIndex() - 1;
350 int subelSide = sideIndexes[el].Side();
367 std::list<TPZAutoPointer<TPZRefPattern> > compat;
369 std::list<TPZAutoPointer<TPZRefPattern> >::iterator it = compat.begin();
370 while(it != compat.end()){
371 if(*it == uniform)
break;
374 if(it != compat.end())
380 PZError <<
"TPZGeoElRefPattern<TGeo>::Divide ERROR : Undefined Refinement Pattern!" << std::endl;
389 for(i=0;i<NSubEl;i++) SubElVec[i] =
SubElement(i);
392 std::stringstream sout;
393 sout <<
"Trying to divide element which has subelements " << this->
Index() << std::endl;
394 sout <<
"Subelement indices ";
395 for(i=0; i<NSubEl; i++) sout << SubElVec[i]->
Index() <<
" ";
408 for(j=0;j<nnodes;j++) {
415 for(i=0;i<NSubEl;i++) {
418 for(j=0;j<subcorner;j++) {
420 cornerindexes[j] = np[cornerid];
428 for(sub=0;sub<NSubEl;sub++) {
430 SubElVec[sub]->SetFather(
this);
431 SubElVec[sub]->SetFatherIndex(this->
fIndex);
434 for(i=0;i<NSubEl;i++) {
437 for (j=0;j<refsubel->
NSides();j++){
441 if(refneigh.
Exists() && refneigh != thisside) {
443 for (k=0;k<NSubEl+1;k++){
454 if(!gs.NeighbourExists(neighbour)) gs.SetConnectivity(neighbour);
471 if (loggerrefpattern->isDebugEnabled())
473 std::stringstream sout;
474 sout <<
"Dividing element " << this->
Index() << std::endl;
475 sout <<
"Subelement indices ";
476 for(i=0; i<NSubEl; i++) sout << SubElVec[i]->
Index() <<
" ";
504 for(is=0; is<
nsub; is++)
507 indices[counter] = subel->
NodeIndex(nodeIndexes[is].Side());
519 PZError <<
"Error trying to set a null refinement pattern objetct" << std::endl;
530 LOGPZ_ERROR ( loggerrefpattern,
"\nTrying to set an refPattern to geoEl that is already refined!\nThis try was skipped!\n\n" );
531 std::cout <<
"Trying to set an refPattern to geoEl that is already refined!\nThis try was skipped!\n\n";
539 for(i=0;i<nsubel;i++)
fSubEl[i] = -1;
virtual TPZGeoEl * CreateGeoElement(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index) override
Creates a geometric element according to the type of the father element.
virtual int64_t NodeIndex(int node) const override
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
Contains declaration of TPZGeoElRefLess class which implements the mapping between the master element...
Implements a vector class which allows to use external storage provided by the user. Utility.
virtual void Print(std::ostream &out) override
Print all relevant data of the element to cout.
int MaterialId() const
Returns the material index of the element.
virtual void SetNeighbour(int side, const TPZGeoElSide &neighbour)=0
Fill in the data structure for the neighbouring information.
clarg::argInt nsub("-nsub", "number of substructs", 4)
virtual void SetRefPattern(TPZAutoPointer< TPZRefPattern > refpat) override
Defines the refinement pattern. It's used only in TPZGeoElRefPattern objects.
void InitializeUniformRefPattern(MElementType elType)
Initialize the uniform refinement pattern from hard coaded data for an specific geometric element...
Templated vector implementation.
TPZGeoEl * Element(int iel)
It returns the element number iel from the stack of elements of the geometric mesh.
virtual int NCornerNodes() const =0
Returns the number of corner nodes of the element.
REAL RefElVolume() override
Volume of the master element.
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Implements the mapping between the master element and deformed element. Geometry. ...
#define LOGPZ_WARN(A, B)
Define log for warnings.
TPZGeoElSide Neighbour() const
AutoPointerMutexArrayInit tmp
virtual void Divide(TPZVec< TPZGeoEl *> &pv) override
Divides the element and puts the resulting elements in the vector.
TPZGeoMesh * Mesh() const
Returns the mesh to which the element belongs.
virtual int NSides() const =0
Returns the number of connectivities of the element.
TPZTransform Transform(int subElSide, int sub)
It returns the TPZTransform associated with a certain sub-element's side to the father's coordinates...
virtual int64_t NodeIndex(int i) const =0
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
void InternalNodesIndexes(int side, TPZVec< TPZGeoElSideIndex > &nodeIndexes)
TPZRefPatternDataBase gRefDBase
External variable to data base of patterns.
virtual TPZAutoPointer< TPZRefPattern > GetRefPattern() const override
Returns the refinement pattern associated with the element.
void CreateNewNodes(TPZGeoEl *gel, TPZVec< int64_t > &newnodeindexes)
This method is used to create / identify the nodes of the refined elements.
virtual TPZGeoEl * ClonePatchEl(TPZGeoMesh &DestMesh, std::map< int64_t, int64_t > &gl2lcNdIdx, std::map< int64_t, int64_t > &gl2lcElIdx) const override
Creates a clone of this element into a new patch mesh.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
void Write(TPZStream &str, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
void Read(TPZStream &str, void *context) override
read objects from the stream
virtual void CenterPoint(int side, TPZVec< REAL > &masscent) const override
It returns the coordinates of the center of the side of the element.
void Push(const T object)
Pushes a copy of the object on the stack.
virtual int NSides() const override
Returns the number of connectivities of the element.
TPZAutoPointer< TPZRefPattern > GetUniformRefPattern(MElementType type)
Retrieves the uniform refinement pattern for given element type.
int HasSubElement() const override
Returns 1 if the element has subelements along side.
void InternalSidesIndexes(int side, TPZVec< TPZGeoElSideIndex > &sideIndexes)
Fill a vector with TPZGeoElSideIndex_s with respect to internal subelements of a given side...
virtual TPZGeoEl * Clone(TPZGeoMesh &DestMesh) const override
int NSideSubElements(int side) const override
Returns the number of subelements as returned by GetSubElements(side)
Implements a generic geometric element which is refined according to a generic refinement pattern...
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
int FatherSide(int side, int sub) const
Returns the father side associated with a given side of a certain sub element.
virtual void SetFatherIndex(int64_t fatherindex)
Sets the father element index This method is not called SetFather in order to avoid implicit conversi...
virtual void ResetSubElements() override
Reset all subelements to NULL.
virtual int Dimension() const override
Returns the dimension of the element.
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
#define DebugStop()
Returns a message to user put a breakpoint in.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
virtual void X(TPZVec< REAL > &coordinate, TPZVec< REAL > &result) const override
Returns the coordinate in real space of the point coordinate in the master element space...
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
int64_t fIndex
Index of the element in the element vector.
virtual MElementType Type() const override
Returns the type of the element acording to the definition in pzeltype.h.
virtual int NCornerNodes() const override
Returns the number of corner nodes of the element.
TPZGeoElRefPattern()
Default constructor.
virtual void GetSubElements2(int side, TPZStack< TPZGeoElSide > &subel) const override
This method will return a partition of the side of the current element as the union of sub elements/...
void SideSubGeoElSide(int fatherSide, int subElPos, TPZGeoElSide &subGeoEl) const
Gives information about the ith subelement contained in a given father's side.
virtual TPZGeoElSide Neighbour(int side)=0
Returns a pointer to the neighbour and the neighbourside along side of the current element...
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
void MidSideNodeIndex(int side, int64_t &index) const override
Returns the midside node index along a side of the element.
Contains the TPZRefPattern class which defines the topology of the current refinement pattern to a me...
virtual int ClassId() const override
Define the class id associated with the class.
int32_t Hash(std::string str)
TPZTransform GetTransform(int side, int son) override
TPZGeoEl * Element() const
int NSideSubGeoElSides(int fatherSide) const
Returns the number of TPZGeoElSides associated with a father's side.
~TPZGeoElRefPattern()
Default destructor.
virtual void Print(std::ostream &out) override
Print all relevant data of the element to cout.
Contains the TPZRefPatternDataBase class which defines data base of patterns.
Defines the topology of the current refinement pattern to a mesh. Refine.
int64_t Id() const
Returns the Id of the element.
This class implements a geometric mesh for the pz environment. Geometry.
MElementType
Define the element types.
This class implements a stack object. Utility.
void MidSideNodeIndices(int side, TPZVec< int64_t > &indices) const override
Returns the midside node indices along a side of the element.
Implements computational mesh. Computational Mesh.
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
Contains the implementation of the TPZGeoElRefPattern methods.
void SetSubElement(int id, TPZGeoEl *el) override
Sets the subelement of index i.
int ClassId() const override
Define the class id associated with the class.
Defines the interface of a computational element. Computational Element.
virtual void SetSubElementConnectivities()
Initializes the external connectivities of the subelements.
TPZGeoEl * Father() const
Computes the normal vectors needed for forming HDiv vector valued shape functions.
void ShortPrint(std::ostream &out=std::cout) const
int NSubElements() const override
Returns the number of subelements of the element independent of the fact whether the element has alr...
TPZGeoEl * SubElement(int is) const override
Returns a pointer to the subelement is.
TPZGeoElSide SideSubElement(int side, int position)
Returns a pointer and a side of the subelement of the element at the side and the indicated position...
#define PZError
Defines the output device to error messages and the DebugStop() function.
TPZGeoEl * CreateGeoElementPattern(TPZGeoMesh &mesh, MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index)
Creates TPZGeoElRefPattern geometric element based over type.
virtual int FatherSide(int side, int son) override
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.
TPZAutoPointer< TPZRefPattern > fRefPattern
int NNodes() const
Returns the number of nodes of the mesh.