50 #ifdef verifyNeighbourhood 51 std::ofstream before(
"before.txt");
52 for(
int s = 0; s < OldElem->
NSides(); s++)
56 while(oldSide != neighSide)
58 before << s <<
"\t" << neighSide.
Element()->
Id() <<
"\t" << neighSide.Side() <<
"\n";
59 neighSide = neighSide.Neighbour();
64 int oldMePosition = -1;
82 std::cout <<
"Null geoel on " << __PRETTY_FUNCTION__ << std::endl;
94 int nsides = OldElem->
NSides();
99 for(
int s = 0; s < nsides; s++)
101 neighbourhood[s].
resize(0);
106 int64_t oldSz = NodesSequence.
NElements();
107 NodesSequence.
resize(oldSz+1);
108 NodesSequence[oldSz] = OldElem->
NodeIndex(s);
110 if(CreateMiddleNodeAtEdge(Mesh, ElemIndex, s, midN))
112 int64_t oldSz = NodesSequence.
NElements();
113 NodesSequence.
resize(oldSz+1);
114 NodesSequence[oldSz] = midN;
116 while(mySide != neighS)
118 neighbourhood[s].push_back(neighS);
124 int64_t oldId = OldElem->
Id();
177 if (!Mesh->
Element(ElemIndex)) {
189 for(
int s = 0; s < nsides; s++)
194 for(uint64_t n = 0; n < neighbourhood[s].
size(); n++)
199 byside = neighS.
Side();
210 #ifdef verifyNeighbourhood 211 std::ofstream after(
"after.txt");
212 for(
int s = 0; s < NewElem->
NSides(); s++)
216 while(newSide != neighSide)
218 after << s <<
"\t" << neighSide.
Element()->
Id() <<
"\t" << neighSide.Side() <<
"\n";
219 neighSide = neighSide.Neighbour();
224 int newMePosition = -1;
236 if(oldFather != newFather || oldMePosition != newMePosition)
254 std::cout <<
"Null geoel on " << __PRETTY_FUNCTION__ << std::endl;
272 TPZPoint::LowerDimensionSides(targetSide,targetSideNodes,0);
273 TPZPoint::LowerDimensionSides(targetSide,targetSideEdges,1);
279 TPZLine::LowerDimensionSides(targetSide,targetSideNodes,0);
280 TPZLine::LowerDimensionSides(targetSide,targetSideEdges,1);
286 TPZTriangle::LowerDimensionSides(targetSide,targetSideNodes,0);
287 TPZTriangle::LowerDimensionSides(targetSide,targetSideEdges,1);
293 TPZQuadrilateral::LowerDimensionSides(targetSide,targetSideNodes,0);
294 TPZQuadrilateral::LowerDimensionSides(targetSide,targetSideEdges,1);
300 TPZTetrahedron::LowerDimensionSides(targetSide,targetSideNodes,0);
301 TPZTetrahedron::LowerDimensionSides(targetSide,targetSideEdges,1);
307 TPZPyramid::LowerDimensionSides(targetSide,targetSideNodes,0);
308 TPZPyramid::LowerDimensionSides(targetSide,targetSideEdges,1);
314 TPZPrism::LowerDimensionSides(targetSide,targetSideNodes,0);
315 TPZPrism::LowerDimensionSides(targetSide,targetSideEdges,1);
321 TPZCube::LowerDimensionSides(targetSide,targetSideNodes,0);
322 TPZCube::LowerDimensionSides(targetSide,targetSideEdges,1);
328 std::cout <<
"Element type not found on " << __PRETTY_FUNCTION__ << std::endl;
333 std::set<int> targetSideNodes_set, targetSideEdges_set, NOTtargetSideEdges_set;
335 for(
int nd = 0; nd < targetSideNodes.
NElements(); nd++)
337 int tsNode = targetSideNodes[nd];
338 targetSideNodes_set.insert(tsNode);
342 targetSideNodes_set.insert(targetSide);
344 for(
int ed = 0; ed < targetSideEdges.
NElements(); ed++)
346 int tsEdge = targetSideEdges[ed];
347 targetSideEdges_set.insert(tsEdge);
351 targetSideEdges_set.insert(targetSide);
356 if(gelSide.
Dimension() == 1 && targetSideEdges_set.find(sd) == targetSideEdges_set.end())
358 NOTtargetSideEdges_set.insert(sd);
366 const REAL
dist = 0.25;
368 std::set<int>::iterator it;
369 for(it = NOTtargetSideEdges_set.begin(); it != NOTtargetSideEdges_set.end(); it++)
386 int64_t meshMiddleNode = gel->
NodeIndex(edg);
389 double coordNear, coordFar;
391 if(targetSideNodes_set.find(initNode) != targetSideNodes_set.end())
393 for(
int c = 0; c < 3; c++)
395 coordNear = Mesh->
NodeVec()[meshInitNode].Coord(c);
396 coordFar = Mesh->
NodeVec()[meshFinalNode].Coord(c);
397 Mesh->
NodeVec()[meshMiddleNode].SetCoord(c, (1. - dist)*coordNear + (dist)*coordFar);
400 else if(targetSideNodes_set.find(finalNode) != targetSideNodes_set.end())
402 for(
int c = 0; c < 3; c++)
404 coordNear = Mesh->
NodeVec()[meshFinalNode].Coord(c);
405 coordFar = Mesh->
NodeVec()[meshInitNode].Coord(c);
406 Mesh->
NodeVec()[meshMiddleNode].SetCoord(c, (1. - dist)*coordNear + (dist)*coordFar);
420 PZError <<
"Error at " << __PRETTY_FUNCTION__ <<
" - NULL geometric element.\n";
424 int64_t oldId = OldElem->
Id();
426 int nsides = OldElem->
NSides();
429 for(
int s = 0; s < nsides; s++)
437 for(
int i = 0; i < nnodes; i++)
446 for(
int s = 0; s < nsides; s++)
461 bool IsNearSomeNode =
false;
464 int nnodes = gel->
NNodes();
466 for(
int n = 0; n < nnodes; n++)
470 for(
int c = 0; c < 3; c++)
472 dist += (x[c] - nodeCoord[c])*(x[c] - nodeCoord[c]);
479 IsNearSomeNode =
true;
484 return IsNearSomeNode;
494 int64_t nnodes = gmesh->
NNodes();
496 for(int64_t n = 0; n < nnodes; n++)
499 gmesh->
NodeVec()[n].GetCoordinates(nodeCoord);
500 for(
int c = 0; c < 3; c++)
502 dist += (x[c] - nodeCoord[c])*(x[c] - nodeCoord[c]);
515 std::cout <<
"Node not found for coordinates ( " << x[0] <<
" , " << x[1] <<
" , " << x[2] <<
" )" << std::endl;
516 std::cout <<
"See " << __PRETTY_FUNCTION__ << std::endl;
536 TPZVec<REAL> n0Coord(3), n1Coord(3), middleCoordLocal(1), middleCoord(3);
537 middleCoordLocal[0] = 0.;
540 myEdge.
X(middleCoordLocal,middleCoord);
541 if(NearestNode(gel, middleCoord, nearestN, 1.E-8))
543 middleNodeId = nearestN;
547 while(neighEdge != myEdge)
549 neighEdge.X(middleCoordLocal,middleCoord);
550 if(NearestNode(neighEdge.Element(), middleCoord, nearestN, 1.E-8))
552 middleNodeId = nearestN;
555 neighEdge = neighEdge.Neighbour();
563 int64_t NewNodeId = Mesh->
NNodes();
569 Mesh->
NodeVec()[middleNodeId] = midNode;
Contains the TPZQuadraticPrism class which defines a prism geometric element with quadratic map...
int AllocateNewElement()
Makes more room for new elements.
Contains the TPZQuadraticPyramid class which defines a pyramid geometric element with quadratic map...
void SetCoord(const TPZVec< REAL > &x)
Sets all coordinates into the current node. It gets the dim values from x.
TPZGeoNode * NodePtr(int i) const
Returns a pointer to the ith node of the element.
Contains the TPZChangeEl class. It is a special map.
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
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.
virtual void resize(const int64_t newsize)
Contains the TPZQuadraticQuad class which defines a quadrilateral geometric element with quadratic ma...
virtual int NCornerNodes() const =0
Returns the number of corner nodes of the element.
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
This class implements a simple vector storage scheme for a templated class T. Utility.
TPZGeoElSide Neighbour() const
virtual int NSides() const =0
Returns the number of connectivities of the element.
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...
virtual TPZGeoEl * CreateGeoBlendElement(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index)
Creates a geometric element in same fashion of CreateGeoElement but here the elements are blend...
virtual TPZGeoEl * SubElement(int is) const =0
Returns a pointer to the subelement is.
int64_t size() const
Returns the number of elements of the vector.
Groups all classes defining the structure of the master element.
Contains the implementation of the TPZGeoElement methods.
Implements a generic geometric element which is refined according to a generic refinement pattern...
int WhichSubel() const
Returns the son number of the sub element gel.
static TPZGeoEl * ChangeToQuadratic(TPZGeoMesh *Mesh, int64_t ElemIndex)
Turns an linear geoelement to quadratic.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
TPZGeoEl * Element(int64_t iel)
static bool CreateMiddleNodeAtEdge(TPZGeoMesh *Mesh, int64_t ElemIndex, int edge, int64_t &middleNodeId)
#define DebugStop()
Returns a message to user put a breakpoint in.
int64_t NNodes() const
Number of nodes of the mesh.
void X(TPZVec< REAL > &loc, TPZVec< REAL > &result) const
X coordinate of a point loc of the side.
virtual MElementType Type() const =0
Returns the element type acording to pzeltype.h.
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
void BuildBlendConnectivity()
Set connectivity information elements with blend geometric map.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
Contains declaration of TPZGeoElRefPattern class which implements a generic geometric element which i...
Contains the TPZQuadraticLine class which defines a linear geometric element with quadratic map...
Contains the TPZQuadraticCube class which defines a cube geometric element with quadratic map...
Contains the TPZQuadraticTrig class which defines a triangular geometric element with quadratic map...
virtual void SetSubElement(int i, TPZGeoEl *gel)=0
Sets the subelement of index i.
virtual int HasSubElement() const =0
Return 1 if the element has subelements.
virtual int NNodes() const =0
Returns the number of nodes of the element.
virtual bool IsLinearMapping() const
TPZGeoEl * Element() const
int64_t SideNodeLocIndex(int nodenum) const
Returns the index of the local nodenum node of side.
void DeleteElement(TPZGeoEl *gel, int64_t index=-1)
Centralized method to delete elements.
void SetNodeIdUsed(int64_t id)
Indicates that a node with id was created.
REAL dist(TPZVec< T1 > &vec1, TPZVec< T1 > &vec2)
static bool NearestNode(TPZGeoEl *gel, TPZVec< REAL > &x, int64_t &meshNode, double tol)
Return if a given point x is near to some node of a given geo element.
int64_t Id() const
Returns the Id of the element.
Implements a geometric node in the pz environment. Geometry.
static TPZGeoEl * ChangeToGeoBlend(TPZGeoMesh *Mesh, int64_t ElemIndex)
Turns a regular element into a geoblend.
This class implements a geometric mesh for the pz environment. Geometry.
MElementType
Define the element types.
static TPZGeoEl * ChangeToQuarterPoint(TPZGeoMesh *Mesh, int64_t ElemIndex, int targetSide)
Slide middle nodes of an quadratic geoelement to the quarterpoint with respect to a given side...
int Dimension() const
the dimension associated with the element/side
void SetFather(TPZGeoEl *father)
Sets the father element.
int64_t NElements() const
Returns the number of elements of the vector.
void GetCoordinates(TPZVec< REAL > &co)
Fill the coordinates of the node.
Groups all classes which model the geometry.
Contains the TPZQuadraticTetra class which defines a tetrahedral geometric element with quadratic map...
virtual int NSubElements() const =0
Returns the number of subelements of the element independent of the fact whether the element has alr...
TPZGeoEl * Father() const
Computes the normal vectors needed for forming HDiv vector valued shape functions.
int64_t SideNodeIndex(int nodenum) const
Returns the index of the nodenum node of side.
#define PZError
Defines the output device to error messages and the DebugStop() function.
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.