本文整理汇总了C++中TPZCompMesh::LoadReferences方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZCompMesh::LoadReferences方法的具体用法?C++ TPZCompMesh::LoadReferences怎么用?C++ TPZCompMesh::LoadReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPZCompMesh
的用法示例。
在下文中一共展示了TPZCompMesh::LoadReferences方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildReferencePatch
void TPZAdaptMesh::BuildReferencePatch() {
// the fGeoRef elements are a partition of the computational domain (should be)
// create a computational element based on each reference element
TPZGeoMesh *gmesh = fReferenceCompMesh->Reference();
gmesh->ResetReference();
TPZCompMesh *tmpcmesh = new TPZCompMesh (gmesh);
int i,j;
for (i=0;i<fGeoRef.NElements();i++){
long index;
tmpcmesh->CreateCompEl(fGeoRef[i],index);
}
tmpcmesh->CleanUpUnconnectedNodes();
tmpcmesh->ExpandSolution();
TPZStack <long> patchelindex;
TPZStack <TPZGeoEl *> toclonegel;
TPZStack<long> elgraph;
TPZVec<long> n2elgraph;
TPZVec<long> n2elgraphid;
TPZVec<long> elgraphindex;
tmpcmesh->GetNodeToElGraph(n2elgraph,n2elgraphid,elgraph,elgraphindex);
// we use the node to elgraph structure to decide which elements will be included
int clnel = tmpcmesh->NElements();
// clnel corresponds to the number of patches
// fPatch and fPatchIndex form a compacted list which form the patches.
// Boundary elements will be added to each patch.
fPatchIndex.Push(0);
for (int ipatch=0; ipatch<clnel; ipatch++){
tmpcmesh->GetElementPatch(n2elgraph,n2elgraphid,elgraph,elgraphindex,ipatch,patchelindex);
for (j=0; j<patchelindex.NElements(); j++){
TPZGeoEl *gel = tmpcmesh->ElementVec()[patchelindex[j]]->Reference();
// int count = 0;
if(gel) fPatch.Push(gel);
}
int sum = fPatch.NElements();
fPatchIndex.Push(sum);
}
#ifdef DEBUG2
// CAJU TOOL
{
std::string filename("cMeshVtk.");
{
std::stringstream finalname;
finalname << filename << 0 << ".vtk";
ofstream file(finalname.str().c_str());
/** @brief Generate an output of all geometric elements that have a computational counterpart to VTK */
//static void PrintCMeshVTK(TPZGeoMesh *gmesh, std::ofstream &file, bool matColor = false);
TPZVTKGeoMesh::PrintCMeshVTK(gmesh,file,true);
}
for (int ip=0; ip<clnel; ip++) {
int firstindex = fPatchIndex[ip];
int lastindex = fPatchIndex[ip+1];
gmesh->ResetReference();
tmpcmesh->LoadReferences();
std::set<TPZGeoEl *> loaded;
for (int ind=firstindex; ind<lastindex; ind++) {
TPZGeoEl *gel = fPatch[ind];
loaded.insert(gel);
}
int ngel = gmesh->NElements();
for (int el=0; el<ngel; el++) {
TPZGeoEl *gel = gmesh->ElementVec()[el];
if (!gel) {
continue;
}
if (gel->Reference() && loaded.find(gel) == loaded.end()) {
gel->ResetReference();
}
}
std::stringstream finalname;
finalname << filename << ip+1 << ".vtk";
ofstream file(finalname.str().c_str());
/** @brief Generate an output of all geometric elements that have a computational counterpart to VTK */
//static void PrintCMeshVTK(TPZGeoMesh *gmesh, std::ofstream &file, bool matColor = false);
TPZVTKGeoMesh::PrintCMeshVTK(gmesh,file,true);
}
}
#endif
// cleaning reference to computational elements into temporary cmesh
gmesh->ResetReference();
delete tmpcmesh;
// loading references between geometric and computational meshes (originals)
fReferenceCompMesh->LoadReferences();
}
示例2: main
//.........这里部分代码省略.........
// cout << "Check 2: number of reference elements for patch after createcompel: " << patch.NElements() << endl;
clonecmesh->CleanUpUnconnectedNodes();
// clonecmesh->Print(cout);
clonecmesh->GetNodeToElGraph(n2elgraph,n2elgraphid,elgraph,elgraphindex);
int64_t clnel = clonecmesh->NElements();
// cout << "Number of elements in clonemessh: " << clnel << endl;
//o primeiro patch come�a em zero
patchindex.Push(0);
for (i=0; i<clnel; i++){
//cout << endl << endl << "Evaluating patch for element: " << i << endl;
clonecmesh->GetElementPatch(n2elgraph,n2elgraphid,elgraph,elgraphindex,i,patchel);
cout << "Patch elements: " << patchel.NElements() << endl;
/*for (k=0;k<patchel.NElements();k++){
clonecmesh->ElementVec()[patchel[k]]->Reference()->Print();
cout << endl;
}*/
for (j=0; j<patchel.NElements(); j++){
//obten��o do elemento geom�trico do patch
//cout << "Creating geometric clone elements for computational element :" << j << endl;
TPZGeoEl *gel = clonecmesh->ElementVec()[patchel[j]]->Reference();
//gel->Print(cout);
//inserir todos os pais do elemento geom�trico do patch
int64_t count = 0;
//cout << "Inserting father element:" << "\t";
while(gel){
TPZGeoEl *father = gel->Father();
if (father){
//father->Print(cout);
gel = father;
continue;
}
else toclonegel.Push(gel);
gel = father;
//cout << count << "\t";
count ++;
}
//cout << endl;
}
int64_t sum = toclonegel.NElements()-1;
//cout << endl << sum << endl;
patchindex.Push(sum);
/*for (k=patchindex[i];k<patchindex[i+1];k++){
toclonegel[k]->Print();
}*/
}
cout <<endl;
cout << endl;
TPZGeoCloneMesh geoclone(&geomesh);
TPZStack<TPZGeoEl*> testpatch;
for (j=0; j<1/*patchindex.NElements()-1*/;j++){
cout << "\n\n\nClone do Patch do elemento: " << j <<endl;
k=0;
cout << patchindex[j] << "\t" << patchindex[j+1] <<endl;
for (i=patchindex[j];i<=patchindex[j+1];i++){
testpatch.Push(toclonegel[i]);
toclonegel[i]->Print();
cout << k << endl;
k++;
}
geoclone.SetElements(testpatch,testpatch[patchindex[j]]);
geoclone.Print(cout);
}
//geoclone.SetElements(testpatch);
//geoclone.Print(cout);
/**************************************************************************
* Fim da cria��o do clone
**************************************************************************/
/* output <<"Impress�o dos Pathces\nN�mero total de patches encontrados\t" << patchindex.NElements()-1 << endl;
cout << "\n\n&&&&&&&&&&&&&&&&&&&&&&&&\n N�mero total de patches: " << patchindex.NElements()-1 << endl
<< "&&&&&&&&&&&&&&&&&&&&&&&&" << endl;
for (i=0;i<patchindex.NElements()-1;i++){
cout << "Patch do elemento " << i << "\t" << "N�mero de elementos componentes do patch: " << (patchindex[i+1]-patchindex[i]) << endl;
for (j = patchindex[i]; j<patchindex[i+1]; j++){
toclonegel[j]->Print();
cout << "||||||||||||||||||||||||||||||||" << endl;
}
cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n" <<">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n";
cout.flush();
}
*/
comp->LoadReferences();
cout.flush();
cout << endl;
cout.flush();
delete comp;
delete clonecmesh;
return (0);
}
示例3: TPZCompMesh
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;
}