예제 #1
0
파일: main.cpp 프로젝트: labmec/neopz
void GetElIndexCoarseMesh(TPZAutoPointer<TPZGeoMesh>  gmesh, std::set<int64_t> &coarseindex)
{
    int nel = gmesh->NElements();
    int iel;
    int hassubel=0;
    int dim = gmesh->Dimension();
    int eldim;
    for(iel = 0; iel<nel; iel++)
    {
        TPZGeoEl * gel = gmesh->ElementVec()[iel];
        if(!gel) DebugStop();
        
        hassubel = gel->HasSubElement();
        eldim = gel->Dimension();
        if(!hassubel && eldim ==dim)
        {
            coarseindex.insert(gel->Index());
        }
    }
    
}
예제 #2
0
void TPZDXGraphMesh::DrawSolution(int step, REAL time){//0,
	//								  TPZVec<char *> &scalarnames, TPZVec<char *> &vectornames) {
	
	TPZAutoPointer<TPZMaterial> matp = Material();
	int i,nel;
	if(!matp) return;
	int dim = matp->Dimension();
	int dim1 = dim-1;
	
	int numscal = fScalarNames.NElements();
	int numvec = fVecNames.NElements();
	TPZVec<int> scalind(0);
	TPZVec<int> vecind(0);
	scalind.Resize(numscal);
	vecind.Resize(numvec);
	scalind.Fill(-1);
	vecind.Fill(-1);
	int n;
	for(n=0; n<numscal; n++) {
		scalind[n] = matp->VariableIndex( fScalarNames[n]);
	}
	for(n=0; n<numvec; n++) {
		vecind[n] = matp->VariableIndex( fVecNames[n]);
	}
	fFirstFieldValues[dim1].Push(fNextDataField+1);
	fTimes.Push(time);
	cout << "TPZDXGraphMesh.DrawSolution step = " << step << " time = " << time << endl;
	long numpoints = NPoints();
	TPZVec<int> scal(1);
	for(n=0; n<numscal; n++) {
		(fOutFile) << "object " << fNextDataField << " class array type float rank 0 items "
		<< numpoints << " data follows " << endl;
		scal[0] = scalind[n];
		nel = fNodeMap.NElements();
		for(i=0;i<nel;i++) {
			TPZGraphNode *np = &fNodeMap[i];
			if(np) np->DrawSolution(scal, fStyle);
		}
		(fOutFile) << "attribute \"dep\" string \"positions\"" << endl;
		(fOutFile) << "#" << endl;
		fNextDataField ++;
		
		
		//+++++ Cubes    
		if(dim == 3 && (NNodes() == 8 || NNodes() == 6)) {
			(fOutFile) << "object " << (fNextDataField) << " class field" << endl;
			(fOutFile) << "component \"data\" value " << (fNextDataField-1) << endl;
			(fOutFile) << "component \"positions\" value " << fNodePosObject[dim1] << endl;
			(fOutFile) << "component \"connections\" value " << fElConnectivityObject[ECube] << endl;
			(fOutFile) << "attribute \"name\" string \"" << (std::string) fScalarNames[n]
			<< step << (0) << "\"" << endl;
			(fOutFile) << "#" << endl;
			fNextDataField ++;
		}
		
		if(dim == 2 && (NNodes() == 4 || NNodes() == 3)) {
			(fOutFile) << "object " << (fNextDataField) << " class field" << endl;
			(fOutFile) << "component \"data\" value " << (fNextDataField-1) << endl;
			(fOutFile) << "component \"positions\" value " << fNodePosObject[dim1] << endl;
			(fOutFile) << "component \"connections\" value " << fElConnectivityObject[EQuadrilateral] << endl;
			(fOutFile) << "attribute \"name\" string \"" << (std::string) fScalarNames[n]; (fOutFile).flush();
			(fOutFile) << step; (fOutFile).flush();
			(fOutFile) << (0); (fOutFile).flush();
			(fOutFile) << "\""; (fOutFile).flush();
			(fOutFile) << endl; (fOutFile).flush();
			(fOutFile) << "#" << endl; (fOutFile).flush();
			fNextDataField ++;
		}
		if(dim == 1) {
			(fOutFile) << "object " << (fNextDataField) << " class field" << endl;
			(fOutFile) << "component \"data\" value " << (fNextDataField-1) << endl;
			(fOutFile) << "component \"positions\" value " << fNodePosObject[dim1] << endl;
			(fOutFile) << "component \"connections\" value " << fElConnectivityObject[EOned] << endl;
			if(fNormalObject > 0) (fOutFile) << "component \"normals\" value " << fNormalObject << endl;
			(fOutFile) << "attribute \"name\" string \"" << (std::string) fScalarNames[n]
			<< step << (0) << "\"" << endl;
			(fOutFile) << "#" << endl;
			fNextDataField ++;
		}
	}
	TPZVec<int> vec(1);
	for(n=0; n<numvec; n++) {
		(fOutFile) << "object " << fNextDataField << " class array type float rank 1 shape " <<
		matp->NSolutionVariables(vecind[n]) << " items "
		<< numpoints << " data follows " << endl;
		vec[0] = vecind[n];
		nel = fNodeMap.NElements();
		for(i=0;i<nel;i++) {
			TPZGraphNode *np = &fNodeMap[i];
			if(np) np->DrawSolution(vec, fStyle);
		}
		(fOutFile) << "attribute \"dep\" string \"positions\"" << endl;
		(fOutFile) << "#" << endl;
		fNextDataField ++;
		//+++++ Cubes        
		if(dim == 3 && fElConnectivityObject[ECube]) {
			(fOutFile) << "object " << (fNextDataField) << " class field" << endl;
			(fOutFile) << "component \"data\" value " << (fNextDataField-1) << endl;
			(fOutFile) << "component \"positions\" value " << fNodePosObject[dim1] << endl;
			(fOutFile) << "component \"connections\" value " << fElConnectivityObject[ECube] << endl;
			(fOutFile) << "attribute \"name\" string \"" << (std::string) fVecNames[n]
			<< step << (0) << "\"" << endl;
			(fOutFile) << "#" << endl;
			fNextDataField ++;
		}
		//|\|\|\|\|\|\|\|\|\|\|
		if(dim == 2 && fElConnectivityObject[EQuadrilateral]) {
			(fOutFile) << "object " << (fNextDataField) << " class field" << endl;
			(fOutFile) << "component \"data\" value " << (fNextDataField-1) << endl;
			(fOutFile) << "component \"positions\" value " << fNodePosObject[dim1] << endl;
			(fOutFile) << "component \"connections\" value " << fElConnectivityObject[EQuadrilateral] << endl;
			(fOutFile) << "attribute \"name\" string \"" << (std::string) fVecNames[n]
			<< step << (0) << "\"" << endl;
			(fOutFile) << "#" << endl;
			fNextDataField ++;
		}
		if(dim == 2 && fElConnectivityObject[ETriangle]) {
			(fOutFile) << "object " << (fNextDataField) << " class field" << endl;
			(fOutFile) << "component \"data\" value " << (fNextDataField-1) << endl;
			(fOutFile) << "component \"positions\" value " << fNodePosObject[dim1] << endl;
			(fOutFile) << "component \"connections\" value " << fElConnectivityObject[ETriangle] << endl;
			(fOutFile) << "attribute \"name\" string \"" << (std::string) fVecNames[n]
			<< step << (1) << "\"" << endl;
			(fOutFile) << "#" << endl;
			fNextDataField ++;
		}
		if(dim == 1) {
			(fOutFile) << "object " << (fNextDataField) << " class field" << endl;
			(fOutFile) << "component \"data\" value " << (fNextDataField-1) << endl;
			(fOutFile) << "component \"positions\" value " << fNodePosObject[dim1] << endl;
			(fOutFile) << "component \"connections\" value " << fElConnectivityObject[EOned] << endl;
			(fOutFile) << "attribute \"name\" string \"" << (std::string) fVecNames[n]
			<< step << (0) << "\"" << endl;
			(fOutFile) << "#" << endl;
			fNextDataField ++;
		}
	}
}