本文整理汇总了C++中TPZAutoPointer::Reference方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZAutoPointer::Reference方法的具体用法?C++ TPZAutoPointer::Reference怎么用?C++ TPZAutoPointer::Reference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPZAutoPointer
的用法示例。
在下文中一共展示了TPZAutoPointer::Reference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SubStructure
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;
}
示例2: main1
int main1(int argc, char *argv[])
{
#ifdef LOG4CXX
InitializePZLOG();
#endif
TPZTimer total;
total.start();
std::cout << "COMECA O TEMPO"<< std::endl;
int dimension = 3;
int dim = 2;
int maxlevel = 5;
int sublevel = 3;
int plevel = 1;
TPZPairStructMatrix::gNumThreads = 20;
int numthreads = 20;
// tempo.fNumthreads = numthreads; // alimenta timeTemp com o numero de threads
TPZGeoMesh *gmesh = 0;
{
TPZCompEl::SetgOrder(plevel);
TPZAutoPointer<TPZCompMesh> cmesh;
if(0)
{
TPZGenSubStruct sub(dim,maxlevel,sublevel);
cmesh = sub.GenerateMesh();
cmesh->SetDimModel(dim);
gmesh = cmesh->Reference();
}
else
{
dim = 3;
if (1) // Predio Viscoso
{
int dimension = 3;
gmesh = MalhaPredio();
cmesh = new TPZCompMesh(gmesh);
cmesh->SetDimModel(3);
cmesh->SetDefaultOrder(plevel);
cmesh->SetAllCreateFunctionsContinuousWithMem(dimension);
InsertViscoElasticity(cmesh);
cmesh->AutoBuild();
}
else // Cubo Viscoso
{
int dimension = 3;
gmesh = MalhaCubo();
cmesh = new TPZCompMesh(gmesh);
cmesh->SetDimModel(3);
cmesh->SetDefaultOrder(plevel);
cmesh->SetAllCreateFunctionsContinuousWithMem(dimension);
InsertViscoElasticityCubo(cmesh);
cmesh->AutoBuild();
}
}
std::cout << "Numero de equacoes " << cmesh->NEquations() << std::endl;
int numthread_assemble = 20;
int numthread_decompose = 20;
TPZAutoPointer<TPZCompMesh> cmeshauto(cmesh);
TPZDohrStructMatrix dohrstruct(cmeshauto);
dohrstruct.IdentifyExternalConnectIndexes();
std::cout << "Substructuring the mesh\n";
// TPZfTime timetosub; // init of timer
//REAL height = Height(gmesh);
//int nsubstruct = SubStructure(cmesh, height/2);
dohrstruct.SubStructure(16);
// tempo.ft0sub = timetosub.ReturnTimeDouble(); // end of timer
// std::cout << tempo.ft0sub << std::endl;
// sub.SubStructure();
//Teste Skyline
/*
TPZSkylineStructMatrix skyl(cmesh);
TPZFMatrix<REAL> rhsfake(cmesh->NEquations(),1,0);
int numsubmesh = cmesh->NElements();
TPZAutoPointer<TPZGuiInterface> fakegui = new TPZGuiInterface;
int nel = cmesh->NElements();
for (int iel = 0 ; iel < nel ; iel++)
{
TPZSubCompMesh *subcompmesh = dynamic_cast<TPZSubCompMesh*>(cmesh->ElementVec()[iel]);
if(subcompmesh)
{
subcompmesh->SetAnalysisSkyline(0,0,fakegui);
}
}
TPZMatrix<REAL> *stiff2 = skyl.CreateAssemble(rhsfake, fakegui,numthread_assemble,numthread_decompose);
*/
#ifdef LOG4CXX
//.........这里部分代码省略.........