Esempio n. 1
0
void TPZAnalysis::PrePostProcessTable(){
	TPZCompEl *cel;
	int numvar = fTable.fVariableNames.NElements();
	for(int iv=0; iv<numvar; iv++) {
		int numel = fTable.fCompElPtr.NElements();
		for(int iel=0; iel<numel; iel++) {
			cel = (TPZCompEl *) fTable.fCompElPtr[iel];
			if(cel) cel->PrintTitle((char *)fTable.fVariableNames[iv],*(fTable.fOutfile));
		}
	}
	*(fTable.fOutfile) << endl;
	int dim;
	TPZVec<REAL> point(fTable.fDimension);
	for(dim=1; dim<fTable.fDimension+1; dim++) {
		for(int iv=0; iv<numvar; iv++) {
			int numel = fTable.fCompElPtr.NElements();
			for(int iel=0; iel<numel; iel++) {
				int d;
				for(d=0; d<fTable.fDimension; d++) {
					point[d] = fTable.fLocations[iel*fTable.fDimension+d];
				}
				cel = (TPZCompEl *) fTable.fCompElPtr[iel];
				if(cel) cel->PrintCoordinate(point,dim,*(fTable.fOutfile));
			}
		}
		*(fTable.fOutfile) << endl;
	}
}
Esempio n. 2
0
TPZGraphMesh::TPZGraphMesh(TPZCompMesh *cm, int dimension, TPZAutoPointer<TPZMaterial> mat)
{
	int nel,i;
	fElementList.Resize(0);
	fElementList.CompactDataStructure(1);
	fNodeMap.Resize(0);
	fNodeMap.CompactDataStructure(1);
	fMaterial = mat;
	fCompMesh = cm;
	fDimension = dimension;
	//   TPZGeoMesh *geomesh = fCompMesh->Reference();
	//   TPZAdmChunkVector<TPZGeoEl *> &gelvec = geomesh->ElementVec();
	//   TPZGeoEl *ge;
	//   nel = gelvec.NElements();
	//   for(i=0;i<nel;i++) {
	//     ge = gelvec[i];
	//     if(!ge || !ge->Reference() || ge->Reference()->Type() == EInterface ) continue;
	//       ge->Reference()->CreateGraphicalElement(*this, dimension);
	//   }
	
	TPZAdmChunkVector<TPZCompEl *> &celvec = fCompMesh->ElementVec();
	TPZCompEl *ce;
	nel = celvec.NElements();
	for(i=0;i<nel;i++) {
		ce = (TPZCompEl *) celvec[i];
		if(!ce) continue;
		//    if (ce->Dimension() != dimension) continue;
		ce->CreateGraphicalElement(*this, dimension);
	}
	
	fScalarNames = "";
	fVecNames = "";
}
Esempio n. 3
0
TPZDXGraphMesh::TPZDXGraphMesh(TPZCompMesh *cmesh, int dimension, TPZAutoPointer<TPZMaterial> mat, const TPZVec<std::string> &scalarnames, const TPZVec<std::string> &vecnames) :
TPZGraphMesh(cmesh,dimension,mat) {
	SetNames(scalarnames,vecnames);
	fNextDataField = 1;
	fStyle = EDXStyle;
	//	int index = 0;
	TPZCompEl *ce = FindFirstInterpolatedElement(cmesh,dimension);
	fElementType = "noname";
	if(ce) {
		int type = ce->Type();
		if(type == EOned)               fElementType = "lines";
		if(type == ETriangle)           fElementType = "triangles";
		if(type == EQuadrilateral)      fElementType = "quads";
		if(type == ECube)               fElementType = "cubes";
		if(type == EPrisma)             fElementType = "cubes";
		TPZGeoEl *gel = ce->Reference();
		if( type == EDiscontinuous || (type == EAgglomerate && gel) ){
			int nnodes = gel->NNodes();
			if(nnodes==4 && dimension==2) fElementType = "quads";
			if(nnodes==3 && dimension==2) fElementType = "triangles";
			if(dimension==3)              fElementType = "cubes";
		}
	}
	fNumCases = 0;
	fNumConnectObjects[0] = 1;
	fNumConnectObjects[1] = 1;
	fNumConnectObjects[2] = 1;
	fNormalObject = 0;
	
	for(int i = 0; i < 8; i++) fElConnectivityObject[i] = -1;
	
}
Esempio n. 4
0
void ErrorH1(TPZCompMesh *l2mesh, std::ostream &out)
{
    int64_t nel = l2mesh->NElements();
    int dim = l2mesh->Dimension();
    TPZManVector<STATE,10> globerrors(10,0.);
    for (int64_t el=0; el<nel; el++) {
        TPZCompEl *cel = l2mesh->ElementVec()[el];
        if (!cel) {
            continue;
        }
        TPZGeoEl *gel = cel->Reference();
        if (!gel || gel->Dimension() != dim) {
            continue;
        }
        TPZManVector<STATE,10> elerror(10,0.);
        elerror.Fill(0.);
        cel->EvaluateError(SolSuave, elerror, NULL);
        
        int nerr = elerror.size();
        //globerrors.resize(nerr);
#ifdef LOG4CXX
        if (logger->isDebugEnabled()) {
            std::stringstream sout;
            sout << "L2 Error sq of element " << el << elerror[0]*elerror[0];
            LOGPZ_DEBUG(logger, sout.str())
        }
#endif
        for (int i=0; i<nerr; i++) {
            globerrors[i] += elerror[i]*elerror[i];
        }
    }
Esempio n. 5
0
TPZCompEl *TPZGraphMesh::FindFirstInterpolatedElement(TPZCompMesh *mesh, int dim) {
	int64_t nel = mesh->NElements();
	TPZCompEl *cel;
	int64_t iel;
	for(iel=0; iel<nel; iel++) {
		cel = mesh->ElementVec()[iel];
		if(!cel) continue;
		int type = cel->Type();
		if(type == EAgglomerate){
#ifndef STATE_COMPLEX
			if(!cel->Reference()) continue;
			TPZAgglomerateElement *agg = dynamic_cast<TPZAgglomerateElement *>(cel);
			if(agg && agg->Dimension() == dim) return agg;
#else
			DebugStop();
#endif
		}
		if(type == EDiscontinuous){
			TPZCompElDisc *disc = dynamic_cast<TPZCompElDisc *>(cel);
			if(disc && disc->Reference()->Dimension() == dim) return disc;
		}
		TPZCompEl *intel = dynamic_cast<TPZInterpolatedElement *>(cel);
		if(intel && intel->Reference()->Dimension() == dim) return intel;
		TPZSubCompMesh *subcmesh = dynamic_cast<TPZSubCompMesh *> (cel);
		if(subcmesh) {
			intel = FindFirstInterpolatedElement(subcmesh,dim);
			if(intel) return intel;
		}
	}
	return 0;
}
Esempio n. 6
0
void ReadSolution(ifstream &arq, TPZVec<REAL> &sol, TPZCompMesh *cmesh, int &nstate, TPZVec<int> &dimstate){

  int i,j,totaldim=0;
  for(i=0;i<nstate;i++) totaldim += dimstate[i];
  TPZVec<REAL> pt(3,0.);
  TPZVec<REAL> coord(3,0.);
  TPZVec<REAL> auxsol(totaldim,0.);

  int iter = 0;
  int nel = cmesh->NElements();
  int solsize = totaldim * nel;
  sol.Resize(solsize);
  sol.Fill(0.);

  for(i=0; i<nel; i++){
    TPZCompEl *el = cmesh->ElementVec()[i];
    if (!el) continue;
    el->Reference()->CenterPoint(el->Reference()->NSides()-1,pt);
    el->Reference()->X(pt,coord);
    EvaluateSolution(coord,auxsol);
    for (j=0;j<totaldim;j++){
      sol[iter] = auxsol[j];
      iter++;
    }
  }
}
Esempio n. 7
0
void TPZAdaptMesh::RemoveCloneBC(TPZCompMesh *mesh)
{
    int nelem = mesh->NElements();
    int iel;
    for(iel=0; iel<nelem; iel++) {
        TPZCompEl *cel = mesh->ElementVec()[iel];
        if(!cel) continue;
        int matid = cel->Material()->Id();
        if(matid == -1000) delete cel;
    }
}
Esempio n. 8
0
void TPZAnalysis::SetBlockNumber(){
	//enquanto nao compilamos o BOOST no windows, vai o sloan antigo
#ifdef WIN32
	if(!fCompMesh) return;
	fCompMesh->InitializeBlock();
	TPZVec<int> perm,iperm;
	
	TPZStack<int> elgraph,elgraphindex;
	int nindep = fCompMesh->NIndependentConnects();
	fCompMesh->ComputeElGraph(elgraph,elgraphindex);
	int nel = elgraphindex.NElements()-1;
	TPZSloan sloan(nel,nindep);
	sloan.SetElementGraph(elgraph,elgraphindex);
	sloan.Resequence(perm,iperm);
	fCompMesh->Permute(perm);
#else
	if(!fCompMesh) return;
	fCompMesh->InitializeBlock();
	
	TPZVec<int> perm,iperm;
	
	TPZStack<int> elgraph,elgraphindex;
	int nindep = fCompMesh->NIndependentConnects();
	fCompMesh->ComputeElGraph(elgraph,elgraphindex);
	int nel = elgraphindex.NElements()-1;
	int el,ncel = fCompMesh->NElements();
	int maxelcon = 0;
	for(el = 0; el<ncel; el++)
	{
		TPZCompEl *cel = fCompMesh->ElementVec()[el];
		if(!cel) continue;
		std::set<int> indepconlist,depconlist;
		cel->BuildConnectList(indepconlist,depconlist);
		int locnindep = indepconlist.size();
		maxelcon = maxelcon < locnindep ? locnindep : maxelcon;
	}
	fRenumber->SetElementsNodes(nel,nindep);
	//	TPZSloan sloan(nel,nindep,maxelcon);
	fRenumber->SetElementGraph(elgraph,elgraphindex);
	fRenumber->Resequence(perm,iperm);
	fCompMesh->Permute(perm);
	/*
	 fCompMesh->ComputeElGraph(elgraph,elgraphindex);
	 
	 TPZMetis metis(nel,nindep);
	 metis.SetElementGraph(elgraph,elgraphindex);
	 metis.Resequence(perm,iperm);
	 fCompMesh->Permute(iperm);
	 */
	
#endif
	
}
Esempio n. 9
0
void RefinElemComp(TPZCompMesh  *cMesh, int indexEl)
{
    
    TPZVec<int64_t > subindex;
    int64_t nel = cMesh->ElementVec().NElements();
    for(int64_t el=0; el < nel; el++){
        TPZCompEl * compEl = cMesh->ElementVec()[el];
        if(!compEl) continue;
        int64_t ind = compEl->Index();
        if(ind==indexEl){
            compEl->Divide(indexEl, subindex, 1);
        }
    }
}
Esempio n. 10
0
int TPZAdaptMesh::HasTrueError(int clindex, REAL &minerror, TPZVec<REAL> &ervec){
    
    TPZGeoCloneMesh *gmesh = dynamic_cast<TPZGeoCloneMesh *> (fCloneMeshes [clindex]->Reference());
    int nref = gmesh->NReference();
    int i;
    for (i=0;i<nref;i++){
        TPZGeoEl *gel = gmesh->ReferenceElement(i);
        TPZCompEl *cel = gel->Reference();
        if (!cel) continue;
        int celindex = cel->Index();
        if (ervec[celindex] >= minerror) return 1;
    }
    return 0;
}
Esempio n. 11
0
void RefinUniformElemComp(TPZCompMesh  *cMesh, int ndiv)
{
    
    TPZVec<int64_t > subindex;
    for (int64_t iref = 0; iref < ndiv; iref++) {
        TPZAdmChunkVector<TPZCompEl *> elvec = cMesh->ElementVec();
        int64_t nel = elvec.NElements();
        for(int64_t el=0; el < nel; el++){
            TPZCompEl * compEl = elvec[el];
            if(!compEl) continue;
            int64_t ind = compEl->Index();
            compEl->Divide(ind, subindex, 0);
        }
    }
}
Esempio n. 12
0
void CreatInterface(TPZCompMesh *cmesh){
    
    for(int el = 0; el < cmesh->ElementVec().NElements(); el++)
    {
        TPZCompEl * compEl = cmesh->ElementVec()[el];
        if(!compEl) continue;
        int index = compEl ->Index();
        if(compEl->Dimension() == cmesh->Dimension())
        {
            TPZInterpolationSpace * InterpEl = dynamic_cast<TPZInterpolationSpace *>(cmesh->ElementVec()[index]);
            if(!InterpEl) continue;
            InterpEl->CreateInterfaces(false);
        }
    }
    
    // cmesh->AdjustBoundaryElements();
    //cmesh->CleanUpUnconnectedNodes();
}
Esempio n. 13
0
void TPZAnalysisError::EvaluateError(REAL CurrentEtaAdmissible, std::ostream &out) {
	//Code isn�t place to chat
	//#warning Philippe, tambem nao entendo aqui //<!>
	
	TPZManVector<REAL,3> elerror(3);
	elerror.Fill(0.);
	TPZManVector<REAL,3> errorSum(3);
	errorSum.Fill(0.0);
	
	TPZBlock<REAL> *flux = 0;
	int elcounter=0;
	int numel = Mesh()->ElementVec().NElements();
	fElErrors.Resize(numel);
	fElIndexes.Resize(numel);
	Mesh()->ElementSolution().Redim(numel,1);
	//soma de erros sobre os elementos
	int el;
	for(el=0;el< numel;el++) {
		TPZCompEl *elptr = Mesh()->ElementVec()[el];
		if(elptr && !(elptr->Material()->Id() < 0)) {
			elptr->EvaluateError(fExact,elerror, flux);
			int nerrors = elerror.NElements();
			errorSum.Resize(nerrors, 0.);
			for(int ii = 0; ii < nerrors; ii++)
				errorSum[ii] += elerror[ii]*elerror[ii];
			
			fElErrors[elcounter] = elerror[0];
			(Mesh()->ElementSolution())(el,0) = elerror[0];
			fElIndexes[elcounter++] = el;
		} else {
			(Mesh()->ElementSolution())(el,0) = 0.;
		}
	}
	fElErrors.Resize(elcounter);
	fElIndexes.Resize(elcounter);
	fTotalError = sqrt(errorSum[0]);
	Mesh()->EvaluateError(NullFunction,elerror);
	//   fAdmissibleError = CurrentEtaAdmissible*sqrt(true_error*true_error + fTotalError*fTotalError) / sqrt(1.*elcounter);
	//<!>pra compilar
	//Code isn�t place to chat
	//#warning Phil, ver isso urgente. Tiago
	fAdmissibleError = CurrentEtaAdmissible*sqrt(elerror[0]*elerror[0] + fTotalError*fTotalError) / sqrt(1.*elcounter);
}
Esempio n. 14
0
TPZGraphMesh::TPZGraphMesh(TPZCompMesh *cm, int dimension, const std::set<int> & matids, const TPZVec<std::string> &scalarnames, const TPZVec<std::string> &vecnames, const TPZVec<std::string> &tensornames) :
fCompMesh(cm), fDimension(dimension), fMaterialIds(matids), fScalarNames(scalarnames), fVecNames(vecnames), fTensorNames(tensornames)
{
    int64_t nel,i;
    fElementList.Resize(0);
    fElementList.CompactDataStructure(fElementList.NOW);
    fNodeMap.Resize(0);
    fNodeMap.CompactDataStructure(fNodeMap.NOW);
    
    TPZAdmChunkVector<TPZCompEl *> &celvec = fCompMesh->ElementVec();
    TPZCompEl *ce;
    nel = celvec.NElements();
    for(i=0;i<nel;i++) {
        ce = (TPZCompEl *) celvec[i];
        if(!ce) continue;
        ce->CreateGraphicalElement(*this, dimension);
    }
    
}
Esempio n. 15
0
void TPZAnalysisError::EvaluateError(REAL CurrentEtaAdmissible, bool store_error, std::ostream &out) {
	//Code isn�t place to chat
	//#warning Philippe, tambem nao entendo aqui //<!>
	
	TPZManVector<REAL,3> elerror(3);
	elerror.Fill(0.);
	TPZManVector<REAL,3> errorSum(3);
	errorSum.Fill(0.0);
	
	TPZBlock<REAL> *flux = 0;
	int64_t elcounter=0;
	int64_t numel = Mesh()->ElementVec().NElements();
	fElErrors.Resize(numel);
	fElIndexes.Resize(numel);
	Mesh()->ElementSolution().Redim(numel,1);
	// Sum of the errors over all computational elements
	int64_t el;
	for(el=0;el< numel;el++) {
		TPZCompEl *elptr = Mesh()->ElementVec()[el];
		if(elptr && !(elptr->Material()->Id() < 0)) {
			elptr->EvaluateError(fExact,elerror, flux);
			int nerrors = elerror.NElements();
			errorSum.Resize(nerrors, 0.);
			for(int ii = 0; ii < nerrors; ii++)
				errorSum[ii] += elerror[ii]*elerror[ii];
			
			fElErrors[elcounter] = elerror[0];
			(Mesh()->ElementSolution())(el,0) = elerror[0];
			fElIndexes[elcounter++] = el;
		} else {
			(Mesh()->ElementSolution())(el,0) = 0.;
		}
	}
	fElErrors.Resize(elcounter);
	fElIndexes.Resize(elcounter);
	fTotalError = sqrt(errorSum[0]);
//    void NullFunction(TPZVec<REAL> &point,TPZVec<STATE>&val,TPZFMatrix<STATE> &deriv);

    std::function<void(const TPZVec<REAL> &,TPZVec<STATE>&,TPZFMatrix<STATE> &)> func(NullFunction);
	Mesh()->EvaluateError(func,store_error, elerror);
	fAdmissibleError = CurrentEtaAdmissible*sqrt(elerror[0]*elerror[0] + fTotalError*fTotalError) / sqrt(1.*elcounter);
}
Esempio n. 16
0
void TPZMGAnalysis::MeshError(TPZCompMesh *fine, TPZCompMesh *coarse, TPZVec<REAL> &ervec,
							  void (*f)(TPZVec<REAL> &loc, TPZVec<REAL> &val, TPZFMatrix<REAL> &deriv),TPZVec<REAL> &truervec){
	coarse->Reference()->ResetReference();
	coarse->LoadReferences();
	int dim = fine->MaterialVec().begin()->second->Dimension();
	ervec.Resize(coarse->NElements());
	if(f) {
		truervec.Resize(coarse->NElements());
		truervec.Fill(0.,0);
	}
	ervec.Fill(0.,0);
	TPZCompEl *cel;
	TPZAdmChunkVector<TPZCompEl *> &elementvec = fine->ElementVec();
	int numel = elementvec.NElements();
	int el;
	for(el=0; el<numel; el++) {
		cel = elementvec[el];
		if (!cel) continue;
		TPZInterpolatedElement *cint = dynamic_cast<TPZInterpolatedElement *> (cel);
		if(!cint) continue;
		int ncon = cint->NConnects();
		TPZGeoElSide gelside(cint->Reference(),ncon-1);
		if(gelside.Dimension() != dim) continue;
		TPZGeoElSide gellarge(gelside);
		while(!gellarge.Reference().Exists() && gellarge.Father2().Exists()) gellarge = gellarge.Father2();
		if(!gellarge.Reference().Exists()) {
			cout << "TPZMGAnalsysis::BuildTransferMatrix element " << el << " found no corresponding element\n";
			continue;
		}
		TPZCompElSide cellargeside = gellarge.Reference();
		TPZCompEl *cellarge = cellargeside.Element();
		TPZInterpolatedElement *cintlarge = (TPZInterpolatedElement *) cellarge;
		TPZTransform transform(gelside.Dimension(),gellarge.Dimension());
		gelside.SideTransform3(gellarge,transform);
		int index = cellarge->Index();
		REAL truerror = 0.;
		ervec[index] += ElementError(cint,cintlarge,transform,f,truerror);
		if(f) truervec[index]  += truerror;
	}
}
Esempio n. 17
0
void TPZGraphMesh::SetCompMesh(TPZCompMesh *mesh, const std::set<int> & matids){
	if(fCompMesh == mesh && matids == fMaterialIds) return;
	int64_t i;
	fCompMesh = mesh;
	fMaterialIds = matids;
	int64_t nel = fElementList.NElements();
	TPZGraphEl *el;
	for(i=0;i<nel;i++) {
		el = fElementList[i]; 
		if(!el) continue;
		if(el) delete el;
	}
	fElementList.Resize(0);
	fNodeMap.Resize(0);
	TPZAdmChunkVector<TPZCompEl *> &celvec = fCompMesh->ElementVec();
	TPZCompEl *ce;
	nel = celvec.NElements();
	for(i=0;i<nel;i++) {
		ce = (TPZCompEl *) celvec[i];
		if(ce)  ce->CreateGraphicalElement(*this, fDimension);
	}	
}
Esempio n. 18
0
void TPZDarcyAnalysis::CreateInterfaces()
{
    fgmesh->ResetReference();
    fcmeshdarcy->LoadReferences();
    
    // Creation of interface elements
    int nel = fcmeshdarcy->ElementVec().NElements();
    for(int el = 0; el < nel; el++)
    {
        TPZCompEl * compEl = fcmeshdarcy->ElementVec()[el];
        if(!compEl) continue;
        TPZGeoEl * gel = compEl->Reference();
        if(!gel) {continue;}
        if(gel->HasSubElement()) {continue;}
        int index = compEl ->Index();
        if(compEl->Dimension() == fcmeshdarcy->Dimension())
        {
            TPZMultiphysicsElement * InterpEl = dynamic_cast<TPZMultiphysicsElement *>(fcmeshdarcy->ElementVec()[index]);
            if(!InterpEl) continue;
            InterpEl->CreateInterfaces();
        }
    }
}
Esempio n. 19
0
TPZMultiphysicsInterfaceElement * TPZMultiphysicsElement::CreateInterface(int side)
{
	//  LOGPZ_INFO(logger, "Entering CreateInterface");
	TPZMultiphysicsInterfaceElement * newcreatedinterface = NULL;
	
	TPZGeoEl *ref = Reference();
	if(!ref) {
		LOGPZ_WARN(logger, "Exiting CreateInterface Null reference reached - NULL interface returned");
		return newcreatedinterface;
	}
	
	TPZCompElSide thisside(this,side);
	TPZStack<TPZCompElSide> list;
	list.Resize(0);
	thisside.EqualLevelElementList(list,0,0);//retorna distinto ao atual ou nulo
	int64_t size = list.NElements();
	//espera-se ter os elementos computacionais esquerdo e direito
	//ja criados antes de criar o elemento interface
    // try to create an interface element between myself and an equal sized neighbour
    for (int64_t is=0; is<size; is++)
    {
		//Interface has the same material of the neighbour with lesser dimension.
		//It makes the interface have the same material of boundary conditions (TPZCompElDisc with interface dimension)
		int matid;
		int thisdim = this->Dimension();
		int neighbourdim = list[is].Element()->Dimension();
        
        if(thisdim != neighbourdim)
        {
            if (thisdim < neighbourdim)
            {
                // return the material id of boundary condition IF the associated material is derived from bndcond
                TPZMaterial *mat = this->Material();
                TPZBndCond *bnd = dynamic_cast<TPZBndCond *>(mat);
                if(bnd)
                {
                    matid = this->Material()->Id();
                }
                else
                {
                    matid = this->Mesh()->Reference()->InterfaceMaterial(this->Reference()->MaterialId(),list[0].Element()->Reference()->MaterialId());
                    continue;
                }
            }
			else
            {
                TPZMaterial *mat = list[is].Element()->Material();
                TPZBndCond *bnd = dynamic_cast<TPZBndCond *>(mat);
                if (bnd) {
                    matid = bnd->Id();
                }
                else {
                    matid = this->Mesh()->Reference()->InterfaceMaterial(this->Reference()->MaterialId(), list[0].Element()->Reference()->MaterialId());
                    continue;
                }
            }
        }else
        {
            matid = this->Mesh()->Reference()->InterfaceMaterial(this->Reference()->MaterialId(), list[0].Element()->Reference()->MaterialId());
            if(matid == GMESHNOMATERIAL)
            {
                continue;
            }
        }
		
		int64_t index;
		
		
		TPZGeoEl *gel = ref->CreateBCGeoEl(side,matid); //isto acertou as vizinhanas da interface geometrica com o atual
		if(!gel){
			DebugStop();
#ifdef LOG4CXX
            if (logger->isDebugEnabled())
			{
				std::stringstream sout;
				sout << "CreateBCGeoEl devolveu zero!@@@@";
				LOGPZ_DEBUG(logger,sout.str());
			}
#endif
		}
        bool withmem = fMesh->ApproxSpace().NeedsMemory();
		if(Dimension() > list[is].Reference().Dimension()) {
			//o de volume eh o direito caso um deles seja BC
			//a normal aponta para fora do contorno
			TPZCompElSide thiscompelside(this, thisside.Side());
			TPZCompElSide neighcompelside(list[is]);
            if (!withmem) {
                newcreatedinterface = new TPZMultiphysicsInterfaceElement(*fMesh,gel,index,thiscompelside,neighcompelside);
            }
            else
            {
                newcreatedinterface = new TPZCompElWithMem<TPZMultiphysicsInterfaceElement>(*fMesh,gel,index,thiscompelside,neighcompelside);
            }
		} else {
			//caso contrario ou caso ambos sejam de volume
			TPZCompElSide thiscompelside(this, thisside.Side());
			TPZCompElSide neighcompelside(list[is]);
            if (!withmem) {
                newcreatedinterface = new TPZMultiphysicsInterfaceElement(*fMesh,gel,index,neighcompelside,thiscompelside);
            }
            else
            {
                newcreatedinterface = new TPZCompElWithMem<TPZMultiphysicsInterfaceElement>(*fMesh,gel,index,neighcompelside,thiscompelside);
            }
		}
		
		
		
		return newcreatedinterface;
	}
	
	//If there is no equal or lower level element, we try the lower elements.
	//Higher elements will not be considered by this method. In that case the interface must be created by the neighbour.
	TPZCompElSide lower = thisside.LowerLevelElementList(0);
	if(lower.Exists()){
		//Interface has the same material of the neighbour with lesser dimension.
		//It makes the interface has the same material of boundary conditions (TPZCompElDisc with interface dimension)
		int matid = GMESHNOMATERIAL;
		int thisdim = this->Dimension();
		int neighbourdim = lower.Element()->Dimension();
        matid = this->Mesh()->Reference()->InterfaceMaterial(this->Material()->Id(), lower.Element()->Material()->Id() );
		
		if (matid == GMESHNOMATERIAL && thisdim == neighbourdim){
			//      matid = this->Material()->Id();
            //break;
        }
        else if(matid == GMESHNOMATERIAL && thisdim != neighbourdim)
        {
			if (thisdim < neighbourdim) 
            {
                // return the material id of boundary condition IF the associated material is derived from bndcond
                TPZMaterial *mat = this->Material();
                TPZBndCond *bnd = dynamic_cast<TPZBndCond *>(mat);
                if(bnd)
                {
                    matid = this->Material()->Id();
                }
                else {
                    //continue;
                }
            }
			else 
            {
                TPZMaterial *mat = lower.Element()->Material();
                TPZBndCond *bnd = dynamic_cast<TPZBndCond *>(mat);
                if (bnd) {
                    matid = bnd->Id();
                }
                else {
                    //continue;
                }
            }
		}
		
        // return zero
        if(matid == GMESHNOMATERIAL)
        {
            return newcreatedinterface;
        }
		
		TPZCompEl *lowcel = lower.Element();
		//int lowside = lower.Side();
		//existem esquerdo e direito: this e lower
		TPZGeoEl *gel = ref->CreateBCGeoEl(side,matid);
		int64_t index;
		
        bool withmem = fMesh->ApproxSpace().NeedsMemory();
        
		if(Dimension() > lowcel->Dimension()){
			//para que o elemento esquerdo seja de volume
			TPZCompElSide thiscompelside(this, thisside.Side());
			TPZCompElSide lowcelcompelside(lower);
            if (!withmem) {
                newcreatedinterface = new TPZMultiphysicsInterfaceElement(*fMesh,gel,index,thiscompelside,lowcelcompelside);
            }
            else
            {
                newcreatedinterface = new TPZCompElWithMem<TPZMultiphysicsInterfaceElement>(*fMesh,gel,index,thiscompelside,lowcelcompelside);
            }
		} else {
			TPZCompElSide thiscompelside(this, thisside.Side());
			TPZCompElSide lowcelcompelside(lower);
#ifdef LOG4CXX_KEEP
            if (logger->isDebugEnabled())
			{
				std::stringstream sout;
				sout << __PRETTY_FUNCTION__ << " left element";
				sout << lowcelcompelside << thiscompelside;
				sout << "Left Element ";
				lowcelcompelside.Element()->Print(sout);
				sout << "Right Element ";
				thiscompelside.Element()->Print(sout);
				LOGPZ_DEBUG(logger,sout.str())
			}
#endif
            if (!withmem)
            {
                newcreatedinterface = new TPZMultiphysicsInterfaceElement(*fMesh,gel,index,lowcelcompelside,thiscompelside);
            }
            else
            {
                newcreatedinterface = new TPZCompElWithMem<TPZMultiphysicsInterfaceElement>(*fMesh,gel,index,lowcelcompelside,thiscompelside);
            }
		}
Esempio n. 20
0
void InputDataStruct::UpdateLeakoff(TPZCompMesh * cmesh)
{
  
  
#ifdef PZDEBUG
  if(fLeakoffmap.size() == 0)
  {//Se a fratura nao alcancou ainda a regiao elastica 2, este mapa estah vazio!!!
   //DebugStop();
  }
#endif
  
  std::map<int,REAL>::iterator it;
  
  int outVlCount = 0;
  for(int i = 0;  i < cmesh->ElementVec().NElements(); i++)
  {
    ///////////////////////
    TPZCompEl * cel = cmesh->ElementVec()[i];
    
#ifdef PZDEBUG
    if(!cel)
    {
      DebugStop();
    }
#endif
    
    TPZGeoEl * gel = cel->Reference();
    
    if(gel->Dimension() != 1)
    {
      continue;
    }
    
    TPZInterpolatedElement * sp = dynamic_cast <TPZInterpolatedElement*> (cel);
    if(!sp)
    {
      continue;
    }
    
    it = globFractInputData.GetLeakoffmap().find(gel->Id());
    
    if(it == globFractInputData.GetLeakoffmap().end())
    {
      continue;
    }
    
    TPZVec<REAL> qsi(1,0.);
    cel->Reference()->CenterPoint(cel->Reference()->NSides()-1, qsi);
    TPZMaterialData data;
    sp->InitMaterialData(data);
    
    sp->ComputeShape(qsi, data);
    sp->ComputeSolution(qsi, data);
    
    REAL pfrac = data.sol[0][0];
    ///////////////////////
    
    REAL deltaT = globFractInputData.actDeltaT();
    
    REAL VlAcum = it->second;
    REAL tStar = FictitiousTime(VlAcum, pfrac);
    REAL Vlnext = VlFtau(pfrac, tStar + deltaT);
    
    if (fusingLeakOff) {
      it->second = Vlnext;
    }
    else{
      it->second = 0.;
    }

    outVlCount++;
  }
  
#ifdef PZDEBUG
  if(outVlCount < globFractInputData.GetLeakoffmap().size())
  {
    DebugStop();
  }
#endif
}
Esempio n. 21
0
int SubStructure(TPZAutoPointer<TPZCompMesh> cmesh, REAL height)
{
	int nelem = cmesh->NElements();
	TPZManVector<int> subindex(nelem,-1);
	int iel;
	int nsub = 0;
	for (iel=0; iel<nelem; iel++) 
	{
		TPZCompEl *cel = cmesh->ElementVec()[iel];
		if (!cel) {
			continue;
		}
		TPZGeoEl *gel = cel->Reference();
		if (!gel) {
			continue;
		}
		int nsides = gel->NSides();
		TPZManVector<REAL> center(gel->Dimension(),0.), xco(3,0.);
		gel->CenterPoint(nsides-1,center);
		gel->X(center,xco);
		REAL z = xco[2];
		int floor = (int) z/height;
		nsub = (floor+1) > nsub ? (floor+1) : nsub;
		subindex[iel] = floor;
	}
	
#ifdef DEBUG 
	{
		TPZGeoMesh *gmesh = cmesh->Reference();
		int nelgeo = gmesh->NElements();
		TPZVec<int> domaincolor(nelgeo,-999);
		int cel;
		int nel = cmesh->NElements();
		for (cel=0; cel<nel; cel++) {
			TPZCompEl *compel = cmesh->ElementVec()[cel];
			if(!compel) continue;
			TPZGeoEl *gel = compel->Reference();
			if (!gel) {
				continue;
			}
			domaincolor[gel->Index()] = subindex[cel];
		}
		ofstream vtkfile("partition.vtk");
		TPZVTKGeoMesh::PrintGMeshVTK(gmesh, vtkfile, domaincolor);
	}
#endif
	
	int isub;
	TPZManVector<TPZSubCompMesh *> submeshes(nsub,0);
	for (isub=0; isub<nsub; isub++) 
	{
		int index;
		std::cout << '^'; std::cout.flush();
		submeshes[isub] = new TPZSubCompMesh(cmesh,index);
		
		if (index < subindex.NElements()) 
		{
			subindex[index] = -1;
		}
	}
	for (iel=0; iel<nelem; iel++) 
	{
		int domindex = subindex[iel];
		if (domindex >= 0) 
		{
			TPZCompEl *cel = cmesh->ElementVec()[iel];
			if (!cel) 
			{
				continue;
			}
			submeshes[domindex]->TransferElement(cmesh.operator->(),iel);
		}
	}
	cmesh->ComputeNodElCon();
	for (isub=0; isub<nsub; isub++) 
	{
		submeshes[isub]->MakeAllInternal();
		std::cout << '*'; std::cout.flush();
	}
	
	cmesh->ComputeNodElCon();
	cmesh->CleanUpUnconnectedNodes();
	return nsub;
}
Esempio n. 22
0
//void DivideRecursive(TPZCompEl *locel,int index,TPZVec<int> indexsubs,int hn);
void TPZAnalysisError::HPAdapt(REAL CurrentEtaAdmissible, std::ostream &out) {
	
	arq << "CurrentEtaAdmissible "  << CurrentEtaAdmissible << endl;
	
	TPZAdmChunkVector<TPZCompEl *>&listel = Mesh()->ElementVec();
    bool store_error = false;
	EvaluateError(CurrentEtaAdmissible,store_error, out);
	TPZVec<TPZCompElSide> SingLocal(fSingular);
	fSingular.Resize(0);
	
	int64_t nel = fElIndexes.NElements();
	for(int64_t ielloc=0;ielloc<nel;ielloc++) {
		int64_t iel = fElIndexes[ielloc];
		// if the element has already been treated (e.g. singularity) skip the process
		if(iel == -1) continue;
		TPZInterpolatedElement *elem = (TPZInterpolatedElement *) listel[iel];
		if(!elem || elem->Material()->Id() < 0) {
			PZError << "TPZAnalysisError::HPAdapt boundary element with error?\n";
			PZError.flush();
			continue;
		}
		REAL csi = fElErrors[ielloc] / fAdmissibleError;
		// Verificar se o element atual e um elemento singular
		int64_t ising, nsing = SingLocal.NElements();
		for(ising=0; ising<nsing; ising++) {
			if(elem == SingLocal[ising].Element()) {
				ZoomInSingularity(csi,SingLocal[ising]);
				break;
			}
		}
		// Go to the end of the loop if the element was handled by the singularity
		if(ising < nsing) continue;
		//calculo da ordem pn do elemento atual
		int nsides = elem->Reference()->NSides();
		REAL pFo = double(elem->EffectiveSideOrder(nsides-1));//quadrilatero
		
		// Newton's Method -> compute pNew    
		REAL pFn = pFo, res = 10.0, phi, del, dph, tol = 0.001;
		int64_t MaxIter = 100; int64_t iter=0;
		while (iter < MaxIter && res > tol) {
			phi = pFo+log(csi)-pFo*log(pFn/pFo);
			dph = pFn/(pFo+pFn);
			del = dph*(phi-pFn);
			if (del+pFn <= 0.0) // caiu fora do intervalo!
				del = 0.5 - pFn;
			res = fabs(del);
			pFn = del+pFn;
			iter++;
		} // end of Newton's Method
		
		if (iter == MaxIter)
			PZError << "\n - Newton's Method Failed at Element = " << elem->Reference()->Id() << endl;
		if(pFn < 1.) pFn = 1.;
		REAL factor = pow(csi,-1.0/pFn)*(pow(pFn/pFo,pFo/pFn));
		
		if(factor <= 0.75) 
			factor = 0.5;   // refine h
		else factor = 1.0; // don't refine h
		
		// Newton's Method -> compute once again pNew    
		pFn = pFo; iter = 0; res = 10.0;
		while (iter < MaxIter && res > tol) {
			phi = -pFn*log(factor)-log(csi)+pFo*log(pFn/pFo);
			dph = pFn/(pFo-pFn*log(factor));
			del = -dph*phi;
			if (del+pFn <= 0.0) // caiu fora do intervalo!
				del = 0.5 - pFn;
			res = fabs(del);
			pFn = del+pFn;
			iter++;
		} // end of Newton's Method
		
		if (iter == MaxIter)
			PZError << "\n - Newton's Method Failed at Element = " << elem->Reference()->Id() << endl;
		if(pFn < 1.) pFn = 1.;
		int pNew = 0;//(int) floor(pFn + 0.5);  // get the integer
		while(REAL(pNew) < (pFn+0.5)) pNew++;
		TPZVec<REAL> x(3),cs(2,0.);
		elem->Reference()->X(cs,x);
		
		elem->PRefine(pNew);
		TPZCompEl *locel = elem;
		//Divide elements
		if(factor == 0.5 ) {
			TPZVec<int64_t> indexsubs;
			int64_t index = locel->Index();
			elem->Divide(index,indexsubs,1);
		} 
	}
}
Esempio n. 23
0
TPZCompMesh *MalhaCompMultifisica(TPZGeoMesh * gmesh,TPZVec<TPZCompMesh *> meshvec, TPZMatUncoupledPoissonDisc* &mymaterial){
    
    
    // Creating computational mesh for multiphysic elements
    gmesh->ResetReference();
    TPZCompMesh *mphysics = new TPZCompMesh(gmesh);
    
    mphysics->SetAllCreateFunctionsMultiphysicElem();
    
    int dim = 2;
    mphysics->SetDimModel(dim);
    mymaterial = new TPZMatUncoupledPoissonDisc(matId, mphysics->Dimension());
    
    mymaterial->SetParameters(1., 1.);
    mymaterial->SetInternalFlux(-8.,0.);
    //mymaterial->SetInternalFlux(0.,0.);
    
    mymaterial->SetNonSymmetricOne();
    mymaterial->SetNonSymmetricTwo();
    mymaterial->SetPenaltyConstant(0., 0.);
    
    TPZMaterial * mat(mymaterial);
    mphysics->InsertMaterialObject(mat);
    
    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(ForcingF, 5);
    
    //
    //    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(ForcingF);
    mymaterial->SetForcingFunction(forcef);
    
    
    ///Inserir condicao de contorno
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    
    TPZMaterial * BCond0 = mymaterial->CreateBC(mat, bc0,neumann_dirichlet, val1, val2);
    TPZMaterial * BCond2 = mymaterial->CreateBC(mat, bc2,neumann_dirichlet, val1, val2);
    TPZMaterial * BCond1 = mymaterial->CreateBC(mat, bc1,dirichlet, val1, val2);
    TPZMaterial * BCond3 = mymaterial->CreateBC(mat, bc3,dirichlet, val1, val2);
    
    //    TPZMaterial * BCond0 = mymaterial->CreateBC(mat, bc0,dirichlet, val1, val2);
    //    TPZMaterial * BCond2 = mymaterial->CreateBC(mat, bc2,dirichlet, val1, val2);
    //    TPZMaterial * BCond1 = mymaterial->CreateBC(mat, bc1,dirichlet, val1, val2);
    //    TPZMaterial * BCond3 = mymaterial->CreateBC(mat, bc3,dirichlet, val1, val2);
    
    
    mphysics->InsertMaterialObject(BCond0);
    mphysics->InsertMaterialObject(BCond1);
    mphysics->InsertMaterialObject(BCond2);
    mphysics->InsertMaterialObject(BCond3);
    
    mphysics->AutoBuild();
    mphysics->AdjustBoundaryElements();
    mphysics->CleanUpUnconnectedNodes();
    
    //Creating multiphysic elements into mphysics computational mesh
    TPZBuildMultiphysicsMesh::AddElements(meshvec, mphysics);
    TPZBuildMultiphysicsMesh::AddConnects(meshvec,mphysics);
    TPZBuildMultiphysicsMesh::TransferFromMeshes(meshvec, mphysics);
    
    mphysics->Reference()->ResetReference();
    mphysics->LoadReferences();
    
    if (disc_functions==true){
        //criar elementos de interface
        int nel = mphysics->ElementVec().NElements();
        for(int el = 0; el < nel; el++)
        {
            TPZCompEl * compEl = mphysics->ElementVec()[el];
            if(!compEl) continue;
            int index = compEl ->Index();
            if(compEl->Dimension() == mphysics->Dimension())
            {
                TPZMultiphysicsElement * InterpEl = dynamic_cast<TPZMultiphysicsElement *>(mphysics->ElementVec()[index]);
                if(!InterpEl) continue;
                InterpEl->CreateInterfaces();
                
            }
        }
    }
    
    return mphysics;
    
}
Esempio n. 24
0
void TPZCreateApproximationSpace::SetAllCreateFunctions(TPZCompEl &cel, TPZCompMesh *mesh){
	cel.SetCreateFunctions(mesh);
}
Esempio n. 25
0
void TPZAnalysis::PostProcess(TPZVec<REAL> &, std::ostream &out ){
	
	int i, neq = fCompMesh->NEquations();
	TPZVec<REAL> ux((int) neq);
	TPZVec<REAL> sigx((int) neq);
	TPZManVector<REAL,10> values(10,0.);
	TPZManVector<REAL,10> values2(10,0.);
	fCompMesh->LoadSolution(fSolution);
	//	SetExact(&Exact);
	TPZAdmChunkVector<TPZCompEl *> elvec = fCompMesh->ElementVec();
	TPZManVector<REAL,10> errors(10);
	errors.Fill(0.0);
	int nel = elvec.NElements();
	int matId0;
	for(i=0;i<nel;i++) {
		matId0=elvec[i]->Material()->Id();
		if(matId0 > 0)
			break;
	}
	bool lastEl=false;
	for(i=0;i<nel;i++) {
		TPZCompEl *el = (TPZCompEl *) elvec[i];
		if(el) {
			errors.Fill(0.0);
			el->EvaluateError(fExact, errors, 0);
			if(matId0==el->Material()->Id()){
				for(int ier = 0; ier < errors.NElements(); ier++) 	values[ier] += errors[ier] * errors[ier];
				lastEl=false;
			}
			else{
				for(int ier = 0; ier < errors.NElements(); ier++)	values2[ier] += errors[ier] * errors[ier];
				lastEl=true;
			}
		}
		
	}
	int nerrors = errors.NElements();
	
	if (nerrors==4) {
		if(lastEl){
			out << endl << "############" << endl;
			out << endl << "L2 Norm for pressure  = "  << sqrt(values2[0]) << endl;
			out << endl << "L2 Norm for flux = "    << sqrt(values2[1]) << endl;
			out << endl << "L2 Norm for divergence = "    << sqrt(values2[2])  <<endl;
			out << endl << "Hdiv Norm for flux = "    << sqrt(values2[3])  <<endl;

			out << endl << "############" << endl;
			out << endl << "true_error (Norma H1) = "  << sqrt(values[0]) << endl;
			out << endl << "L2_error (Norma L2) = "    << sqrt(values[1]) << endl;
			out << endl << "estimate (Semi-norma H1) = "    << sqrt(values[2])  <<endl;
			
		}
		else{
			out << endl << "############" << endl;
			out << endl << "L2 Norm for pressure  = "  << sqrt(values[0]) << endl;
			out << endl << "L2 Norm for flux = "    << sqrt(values[1]) << endl;
			out << endl << "L2 Norm for divergence = "    << sqrt(values[2])  <<endl;
			out << endl << "Hdiv Norm for flux = "    << sqrt(values[3])  <<endl;
			
			out << endl << "############" << endl;
			out << endl << "true_error (Norma H1) = "  << sqrt(values2[0]) << endl;
			out << endl << "L2_error (Norma L2) = "    << sqrt(values2[1]) << endl;
			out << endl << "estimate (Semi-norma H1) = "    << sqrt(values2[2])  <<endl;
		}
	}
	else {
		if(lastEl){
			out << endl << "############" << endl;
			out << endl << "L2 Norm for pressure  = "  << sqrt(values[0]) << endl;
			out << endl << "L2 Norm for flux = "    << sqrt(values[1]) << endl;
			out << endl << "L2 Norm for divergence = "    << sqrt(values[2])  <<endl;
			out << endl << "Hdiv Norm for flux = "    << sqrt(values[3])  <<endl;
			
			out << endl << "############" << endl;
			out << endl << "true_error (Norma H1) = "  << sqrt(values2[0]) << endl;
			out << endl << "L2_error (Norma L2) = "    << sqrt(values2[1]) << endl;
			out << endl << "estimate (Semi-norma H1) = "    << sqrt(values2[2])  <<endl;
			
		}
		else{
			out << endl << "############" << endl;
			out << endl << "L2 Norm for pressure  = "  << sqrt(values2[0]) << endl;
			out << endl << "L2 Norm for flux = "    << sqrt(values2[1]) << endl;
			out << endl << "L2 Norm for divergence = "    << sqrt(values2[2])  <<endl;
			out << endl << "Hdiv Norm for flux = "    << sqrt(values2[3])  <<endl;
			
			out << endl << "############" << endl;
			out << endl << "true_error (Norma H1) = "  << sqrt(values[0]) << endl;
			out << endl << "L2_error (Norma L2) = "    << sqrt(values[1]) << endl;
			out << endl << "estimate (Semi-norma H1) = "    << sqrt(values[2])  <<endl;
		}
	}
	return;
}
Esempio n. 26
0
// Output as Mathematica format
void OutputMathematica(std::ofstream &outMath,int var,int pointsByElement,TPZCompMesh *cmesh) {
	int i, j, k, nnodes;
	int nelem = cmesh->ElementVec().NElements();
	int dim = cmesh->Dimension();   // Dimension of the model
	REAL w;
	if(var-1 < 0) var = 1;
	// Map to store the points and values 
	map<REAL,TPZVec<REAL> > Graph;
	TPZVec<REAL> tograph(4,0.);
	map<TPZVec<REAL>,REAL> Graphics;
	
	for(i=0;i<nelem;i++) {
		TPZCompEl *cel = cmesh->ElementVec()[i];
		TPZGeoEl *gel = cel->Reference();
		TPZInterpolationSpace * sp = dynamic_cast <TPZInterpolationSpace*>(cel);
		int nstates = cel->Material()->NStateVariables();
		// If var is higher than nstates of the element, go to next element
		if(var > nstates)
			continue;
		TPZVec<REAL> qsi(3,0.), sol(nstates,0.), outfem(3,0.);
		nnodes = gel->NNodes();
		if(pointsByElement < nnodes) pointsByElement = nnodes;
		for(j=0;j<gel->NNodes();j++) {
			// Get corners points to compute solution on
			gel->CenterPoint(j,qsi);
			sp->Solution(qsi,0,sol);
			cel->Reference()->X(qsi,outfem);
			// Jointed point coordinates and solution value on			
			for(k=0;k<3;k++) tograph[k] = outfem[k];
			tograph[k] = sol[var-1];
			Graph.insert(pair<REAL,TPZVec<REAL> >(outfem[0],tograph));
			Graphics.insert(pair<TPZVec<REAL>,REAL>(outfem,sol[var-1]));
			// If cel is point gets one point value
			if(cel->Type() == EPoint) {
				break;
			}
		}
		// If cel is point gets one point value
		if(cel->Type() == EPoint) continue;
		// Print another points using integration points
		TPZIntPoints *rule = NULL;
		int order = 1, npoints = 0;
		while(pointsByElement-(npoints+nnodes) > 0) {
			if(rule) delete rule;   // Cleaning unnecessary allocation
			int nsides = gel->NSides();
			// Get the integration rule to compute internal points to print, not to print
			rule = gel->CreateSideIntegrationRule(nsides-1,order);
			if(!rule) break;
			npoints = rule->NPoints();
			order += 2;
		}
		for(j=0;j<npoints;j++) {
			// Get integration points to get internal points
			rule->Point(j,qsi,w);
			sp->Solution(qsi,0,sol);
			cel->Reference()->X(qsi,outfem);
			// Jointed point coordinates and solution value on
			for(k=0;k<3;k++) tograph[k] = outfem[k];
			tograph[k] = sol[var-1];
			Graph.insert(pair<REAL,TPZVec<REAL> >(outfem[0],tograph));
			Graphics.insert(pair<TPZVec<REAL>,REAL>(outfem,sol[var-1]));
		}
	}
	
	// Printing the points and values into the Mathematica file
	outMath << "Saida = { ";
	// Formatting output
	outMath << fixed << setprecision(10);
	if(dim<2) {
		map<REAL,TPZVec<REAL> >::iterator it;
		for(it=Graph.begin();it!=Graph.end();it++) {
			if(it!=Graph.begin()) outMath << ",";
			outMath << "{";
			for(j=0;j<dim;j++)
				outMath << (*it).second[j] << ",";
			outMath << (*it).second[3] << "}";
		}
		outMath << "};" << std::endl;
		// Choose Mathematica command depending on model dimension
		outMath << "ListPlot[Saida,Joined->True]"<< endl;
	}
	else {
		map<TPZVec<REAL>,REAL>::iterator it;
		for(it=Graphics.begin();it!=Graphics.end();it++) {
			if(it!=Graphics.begin()) outMath << ",";
			outMath << "{";
			for(j=0;j<dim;j++)
				outMath << (*it).first[j] << ",";
			outMath << (*it).second << "}";
		}
		outMath << "};" << std::endl;
		outMath << "ListPlot3D[Saida]"<< endl;
	}
}