本文整理汇总了C++中TPZAutoPointer类的典型用法代码示例。如果您正苦于以下问题:C++ TPZAutoPointer类的具体用法?C++ TPZAutoPointer怎么用?C++ TPZAutoPointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TPZAutoPointer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: InsertViscoElasticity
void InsertViscoElasticity(TPZAutoPointer<TPZCompMesh> mesh)
{
mesh->SetDimModel(3);
int nummat = 1;
STATE Ela = 1.e6;
STATE poisson = 0.2;
TPZManVector<STATE> force(3,0.);
force[2] = -20.;
STATE ElaE = 1000000., poissonE = 0.2, ElaV = 950000., poissonV = 0.14;
STATE lambdaV = 0, muV = 0, alpha = 0, deltaT = 0;
lambdaV = 11.3636;
muV = 45.4545;
alpha = 1.;
deltaT = 0.1;
TPZViscoelastic *viscoelast = new TPZViscoelastic(nummat);
viscoelast->SetMaterialDataHooke(ElaE, poissonE, ElaV, poissonV, alpha, deltaT, force);
TPZMaterial * viscoelastauto(viscoelast);
TPZFMatrix<STATE> val1(3,3,0.),val2(3,1,0.);
TPZBndCond *bc = viscoelast->CreateBC(viscoelastauto, -1, 0, val1, val2);
TPZFNMatrix<6> qsi(6,1,0.);
viscoelast->SetDefaultMem(qsi); //elast
int index = viscoelast->PushMemItem(); //elast
TPZMaterial * bcauto(bc);
mesh->InsertMaterialObject(viscoelastauto);
mesh->InsertMaterialObject(bcauto);
}
开发者ID:labmec,项目名称:neopz,代码行数:29,代码来源:substruct.cpp
示例2: RefinamentoUniforme
void RefinamentoUniforme(TPZAutoPointer<TPZGeoMesh> gmesh, int nref,TPZVec<int> dims)
{
int ir, iel, k;
int nel=0, dim=0;
int ndims = dims.size();
for(ir = 0; ir < nref; ir++ )
{
TPZVec<TPZGeoEl *> filhos;
nel = gmesh->NElements();
for (iel = 0; iel < nel; iel++ )
{
TPZGeoEl * gel = gmesh->ElementVec()[iel];
if(!gel) DebugStop();
dim = gel->Dimension();
for(k = 0; k<ndims; k++)
{
if(dim == dims[k])
{
gel->Divide (filhos);
break;
}
}
}
}
}
开发者ID:labmec,项目名称:neopz,代码行数:30,代码来源:main.cpp
示例3: Material
void TPZDXGraphMesh::DrawSolution(char * var)
{
//int nmat = fCompMesh->MaterialVec().NElements();
TPZAutoPointer<TPZMaterial> matp = Material();
int i,varind;
varind = matp->VariableIndex(var);
TPZVec<int> vec(1);
(fOutFile) << "object " << fNextDataField << " class array type float rank 1 shape " <<
matp->NSolutionVariables(varind) << " items " << NPoints() << " data follows " << endl;
vec[0] = varind;
int nel = fCompMesh->ConnectVec().NElements();
for(i=0;i<nel;i++) {
TPZGraphNode n = fNodeMap[i];
n.DrawSolution(vec,fStyle);
}
(fOutFile) << "attribute \"dep\" string \"positions\"" << endl;
(fOutFile) << "#" << endl;
(fOutFile) << "object " << (fNextDataField+1) << " class field" << endl;
(fOutFile) << "component \"data\" value " << fNextDataField << endl;
// (fOutFile) << "component \"positions\" value " << fNodeCoField << endl;
// (fOutFile) << "component \"connections\" value " << fConnectField << endl;
(fOutFile) << "attribute \"name\" string \"" << var << fNextDataField <<
"\"" << endl;
(fOutFile) << "#" << endl;
fNextDataField += 2;
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:28,代码来源:pzdxmesh.cpp
示例4: SAVEABLE_SKIP_NOTE
void TPZDohrMatrix<TVar, TSubStruct >::Read(TPZStream &buf, void *context )
{
SAVEABLE_SKIP_NOTE(buf);
TPZMatrix<TVar>::Read(buf, context);
SAVEABLE_SKIP_NOTE(buf);
fAssembly = TPZAutoPointerDynamicCast<TPZDohrAssembly<TVar>>(TPZPersistenceManager::GetAutoPointer(&buf));
SAVEABLE_SKIP_NOTE(buf);
buf.Read(&fNumCoarse);
SAVEABLE_SKIP_NOTE(buf);
buf.Read(&fNumThreads);
int sz;
SAVEABLE_SKIP_NOTE(buf);
buf.Read(&sz);
for (int i=0; i<sz; i++) {
TPZAutoPointer<TSubStruct > sub = new TSubStruct;
SAVEABLE_SKIP_NOTE(buf);
sub->Read(buf,0);
fGlobal.push_back(sub);
}
int classid;
SAVEABLE_SKIP_NOTE(buf);
buf.Read(&classid );
if (classid != ClassId()) {
DebugStop();
}
}
开发者ID:labmec,项目名称:neopz,代码行数:26,代码来源:tpzdohrmatrix.cpp
示例5: BoxLinearTracerDual
void BoxLinearTracerDual()
{
// Materials ids and boundary settings
TPZAutoPointer<TRMRawData> RawData = new TRMRawData;
bool Is3DGeometry = true;
// On box reservoir
//RawData->WaterReservoirBox(Is3DGeometry); // Single-phase flow
RawData->WaterOilReservoirBox(Is3DGeometry); // Two-phase flow
// RawData->WaterOilGasReservoirBox(Is3DGeometry); // Three-phase flow
// On cricular reservoir
// RawData->WaterReservoirCircle(Is3DGeometry); // Single-phase flow
// RawData->WaterOilReservoirCircular(Is3DGeometry); // Two-phase flow
// RawData->WaterOilGasReservoirCircular(Is3DGeometry); // Three-phase flow
TRMSimulationData * SimData = new TRMSimulationData;
SimData->SetRawData(RawData);
TRMOrchestra * SymphonyX = new TRMOrchestra;
SymphonyX->SetSimulationData(SimData);
// SymphonyX->BuildGeometry(Is3DGeometry); // @omar:: This mesh must to be unique???
SymphonyX->SetSegregatedQ(true);
SymphonyX->CreateAnalysisDualonBox(true); // Static Solution
SymphonyX->RunStaticProblem();
SymphonyX->CreateAnalysisDualonBox(false); // Evolutionary Solution
SymphonyX->RunEvolutionaryProblem();
std::cout << "Dual complete normally." << std::endl;
}
开发者ID:labmec,项目名称:neopz,代码行数:33,代码来源:iRMS.cpp
示例6: Id
void TPZMaterial::Clone(std::map<int, TPZAutoPointer<TPZMaterial> >&matvec) {
int matid = Id();
std::map<int, TPZAutoPointer<TPZMaterial> >::iterator matit;
matit = matvec.find(matid);
if(matit != matvec.end()) return;
TPZAutoPointer<TPZMaterial> newmat = NewMaterial();
newmat->SetForcingFunction(TPZMaterial::fForcingFunction);
matvec[matid] = newmat;
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:9,代码来源:pzmaterial.cpp
示例7: operator
/** @brief Computing operator for the parallel for. */
void operator()(const blocked_range<size_t>& range) const
{
for(size_t i=range.begin(); i!=range.end(); ++i )
{
TPZDohrThreadMultData<TSubStruct> runner = mWorkItems[i];
TPZFMatrix<TVar> xlocal;
fAssembly->Extract(runner.fisub,*(fInput),xlocal);
TPZAutoPointer<TPZDohrAssembleItem<TVar> > assembleItem = new TPZDohrAssembleItem<TVar>(runner.fisub,xlocal.Rows(),xlocal.Cols());
runner.fSub->ContributeKULocal(fAlpha,xlocal,assembleItem->fAssembleData);
fAssemblyStructure->AddItem(assembleItem);
}
}
开发者ID:labmec,项目名称:neopz,代码行数:14,代码来源:tpzdohrmatrix.cpp
示例8: RefinamentoSingular
void RefinamentoSingular(TPZAutoPointer<TPZGeoMesh> gmesh,int nref)
{
int64_t nnodes = gmesh->NNodes();
int64_t in;
for (in=0; in<nnodes; in++) {
TPZGeoNode *gno = &gmesh->NodeVec()[in];
if (abs(gno->Coord(0))< 1.e-6 && abs(gno->Coord(1)) < 1.e-6) {
break;
}
}
if (in == nnodes) {
DebugStop();
}
TPZGeoElSide gelside;
int64_t nelem = gmesh->NElements();
for (int64_t el = 0; el<nelem; el++) {
TPZGeoEl *gel = gmesh->ElementVec()[el];
int ncorner = gel->NCornerNodes();
for (int ic=0; ic<ncorner; ic++) {
int64_t nodeindex = gel->NodeIndex(ic);
if (nodeindex == in) {
gelside = TPZGeoElSide(gel, ic);
break;
}
}
if (gelside.Element()) {
break;
}
}
if (!gelside.Element()) {
DebugStop();
}
for (int iref = 0; iref <nref; iref++) {
TPZStack<TPZGeoElSide> gelstack;
gelstack.Push(gelside);
TPZGeoElSide neighbour = gelside.Neighbour();
while (neighbour != gelside) {
gelstack.Push(neighbour);
neighbour = neighbour.Neighbour();
}
int64_t nstack = gelstack.size();
for (int64_t ist=0; ist < nstack; ist++) {
if (!gelstack[ist].Element()->HasSubElement()) {
TPZVec<TPZGeoEl *> subel;
gelstack[ist].Element()->Divide(subel);
}
}
}
}
开发者ID:labmec,项目名称:neopz,代码行数:49,代码来源:main.cpp
示例9: InsertElasticity
void InsertElasticity(TPZAutoPointer<TPZCompMesh> mesh)
{
mesh->SetDimModel(3);
int nummat = 1;
STATE E = 1.e6;
STATE poisson = 0.3;
TPZManVector<STATE> force(3,0.);
force[1] = 20.;
TPZElasticity3D *elast = new TPZElasticity3D(nummat,E,poisson,force);
TPZMaterial * elastauto(elast);
TPZFMatrix<STATE> val1(3,3,0.),val2(3,1,0.);
TPZBndCond *bc = elast->CreateBC(elastauto, -1, 0, val1, val2);
TPZMaterial * bcauto(bc);
mesh->InsertMaterialObject(elastauto);
mesh->InsertMaterialObject(bcauto);
}
开发者ID:labmec,项目名称:neopz,代码行数:16,代码来源:substruct.cpp
示例10: PrintLS
void TPZDarcyAnalysis::PrintLS(TPZAnalysis *an)
{
TPZAutoPointer< TPZMatrix<REAL> > KGlobal;
TPZFMatrix<STATE> FGlobal;
KGlobal = an->Solver().Matrix();
FGlobal = an->Rhs();
#ifdef PZDEBUG
#ifdef LOG4CXX
if(logger->isDebugEnabled())
{
std::stringstream sout;
KGlobal->Print("KGlobal = ", sout,EMathematicaInput);
FGlobal.Print("FGlobal = ", sout,EMathematicaInput);
LOGPZ_DEBUG(logger,sout.str())
}
开发者ID:labmec,项目名称:neopz,代码行数:16,代码来源:TPZDarcyAnalysis.cpp
示例11: IterativeProcess
void IterativeProcess(TPZAnalysis *an, std::ostream &out, int numiter)
{
int iter = 0;
REAL error = 1.e10, NormResLambdaLast = 1.e10;;
const REAL tol = 1.e-5;
int numeq = an->Mesh()->NEquations();
TPZFMatrix<STATE> Uatk0(an->Solution());
TPZFMatrix<STATE> Uatk(Uatk0),DeltaU(Uatk0);
if(Uatk0.Rows() != numeq) Uatk0.Redim(numeq,1);
an->Assemble();
an->Rhs() *= -1.0; //- [R(U0)];
TPZAutoPointer< TPZMatrix<STATE> > matK; // getting X(Uatn)
bool converged = false;
while(!converged && iter < numiter) {
#ifdef LOG4CXX
if(logger->isDebugEnabled())
{
std::stringstream sout;
matK=an->Solver().Matrix();
matK->Print("matK = ", sout,EMathematicaInput);
an->Rhs().Print("Rhs = ", sout, EMathematicaInput);
LOGPZ_DEBUG(logger,sout.str())
}
#endif
// Computing Uatk = Uatn + DeltaU;
an->Solve();
DeltaU= an->Solution();
Uatk = Uatk0 + DeltaU;
//Computing ||DeltaU||
REAL NormOfDeltaU = Norm(DeltaU);
#ifdef LOG4CXX
if(logger->isDebugEnabled())
{
std::stringstream sout;
DeltaU.Print("DeltaU = ", sout,EMathematicaInput);
Uatk.Print("Uatk = ", sout,EMathematicaInput);
LOGPZ_DEBUG(logger,sout.str())
}
开发者ID:labmec,项目名称:neopz,代码行数:47,代码来源:Main.cpp
示例12: ReadRefPatternDBase
//.........................................................................................................................................
void TPZRefPatternDataBase::ReadRefPatternDBase(std::ifstream &filename)
{
fElTypeRefPatterns.clear();
fIdRefPatterns.clear();
int nRefpatterns;
filename >> nRefpatterns;
for(int i = 0; i < nRefpatterns; i++)
{
TPZAutoPointer<TPZRefPattern> refP = new TPZRefPattern;
refP->ReadPattern(filename);
MElementType eltype = refP->Element(0)->Type();
fElTypeRefPatterns[eltype].push_back(refP);
fIdRefPatterns[refP->Id()] = refP;
}
}
开发者ID:labmec,项目名称:neopz,代码行数:18,代码来源:TPZRefPatternDataBase.cpp
示例13: Id
void TPZBndCond::Clone(std::map<int, TPZAutoPointer<TPZMaterial> > &matvec) {
int matid = Id();
TPZAutoPointer<TPZMaterial> refmaterial = Material();
TPZAutoPointer<TPZMaterial> newrefmaterial;
int refmatid = 0;
if(refmaterial) {
refmaterial->Clone(matvec);
refmatid = refmaterial->Id();
newrefmaterial = matvec[refmatid];
}
std::map<int, TPZAutoPointer<TPZMaterial> >::iterator matit;
matit = matvec.find(matid);
if(matit == matvec.end())
{
TPZAutoPointer<TPZMaterial> newmat = TPZAutoPointer<TPZMaterial>(new TPZBndCond(*this, newrefmaterial));
matvec[matid] = newmat;
}
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:19,代码来源:pzbndcond.cpp
示例14: GetElIndexCoarseMesh
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());
}
}
}
开发者ID:labmec,项目名称:neopz,代码行数:21,代码来源:main.cpp
示例15: CreateTestMesh
//.........这里部分代码省略.........
int in;
nodeindex.Resize(numnos[nel]);
for(in=0; in<numnos[nel]; in++) {
nodeindex[in] = nodind[nel][in];
}
int index;
switch(nel) {
case 0:
// elvec[el] = gmesh->CreateGeoElement(ECube,nodeindex,1,index);
// gelvec[nel]=new TPZGeoElC3d(nodeindex,matid,*gmesh);
break;
case 1:
gelvec[nel] = gmesh->CreateGeoElement(EPiramide,nodeindex,matid,index);
// gelvec[nel]=new TPZGeoElPi3d(nodeindex,matid,*gmesh);
break;
case 2:
gelvec[nel] = gmesh->CreateGeoElement(ETetraedro,nodeindex,matid,index);
// gelvec[nel]=new TPZGeoElT3d(nodeindex,matid,*gmesh);
break;
case 3:
// gelvec[nel]=new TPZGeoElPr3d(nodeindex,matid,*gmesh);
// gelvec[nel] = gmesh->CreateGeoElement(EPrisma,nodeindex,matid,index);
break;
case 4:
// gelvec[nel]=new TPZGeoEl1d(nodeindex,2,*gmesh);
break;
case 5:
// gelvec[nel]=new TPZGeoElQ2d(nodeindex,3,*gmesh);
break;
case 6:
// gelvec[nel]=new TPZGeoElT2d(nodeindex,3,*gmesh);
break;
default:
break;
}
}
gmesh->BuildConnectivity2();
//TPZVec<TPZGeoEl *> sub;
//elvec[0]->Divide(sub);
// elvec[1]->Divide(sub);
// elvec[2]->Divide(sub);
// TPZGeoElBC gbc;
// bc -1 -> Dirichlet
// TPZGeoElBC gbc1(gelvec[0],20,-1,*gmesh);
TPZGeoElBC gbc11(gelvec[1],14,-1,*gmesh);
// TPZGeoElBC gbc12(gelvec[3],15,-1,*gmesh);
// bc -2 -> Neumann at the right x==1
// TPZGeoElBC gbc2(gelvec[0],25,-2,*gmesh);
// TPZGeoElBC gbc21(gelvec[3],19,-2,*gmesh);
TPZGeoElBC gbc22(gelvec[2],10,-2,*gmesh);
TPZCompMesh *cmesh = new TPZCompMesh(gmesh);
TPZAutoPointer<TPZMaterial> mat;
// if(nstate == 3) {
mat = new TPZMaterialTest3D(1);
TPZFMatrix mp (3,1,0.);
TPZMaterialTest3D * mataux = dynamic_cast<TPZMaterialTest3D *> (mat.operator ->());
TPZMaterialTest3D::geq3=1;
mataux->SetMaterial(mp);
/* } else {
TPZMat2dLin *mat2d = new TPZMat2dLin(1);
int ist,jst;
TPZFMatrix xk(nstate,nstate,1.),xc(nstate,nstate,0.),xf(nstate,1,0.);
for(ist=0; ist<nstate; ist++) {
if(nstate != 1) xf(ist,0) = 1.;
for(jst=0; jst<nstate; jst++) {
if(ist != jst) xk(ist,jst) = 0.;
}
}
mat2d->SetMaterial(xk,xc,xf);
mat = mat2d;
}*/
TPZFMatrix val1(3,3,0.),val2(3,1,0.);
TPZAutoPointer<TPZMaterial> bc[2];
bc[0] = mat->CreateBC(mat,-1,0,val1,val2);
val2(0,0) = 1.;
bc[1] = mat->CreateBC(mat,-2,1,val1,val2);
cmesh->InsertMaterialObject(mat);
int i;
for(i=0; i<2; i++) cmesh->InsertMaterialObject(bc[i]);
gmesh->Print(cout);
cmesh->AutoBuild();
cmesh->AdjustBoundaryElements();
cmesh->CleanUpUnconnectedNodes();
gmesh->Print(cout);
return cmesh;
}
开发者ID:labmec,项目名称:neopz,代码行数:101,代码来源:c08-Mixed.cpp
示例16: void
REAL TPZMGAnalysis::ElementError(TPZInterpolatedElement *fine, TPZInterpolatedElement *coarse, TPZTransform &tr,
void (*f)(TPZVec<REAL> &loc, TPZVec<REAL> &val, TPZFMatrix<REAL> &deriv),REAL &truerror){
// accumulates the transfer coefficients between the current element and the
// coarse element into the transfer matrix, using the transformation t
int locnod = fine->NConnects();
int cornod = coarse->NConnects();
int locmatsize = fine->NShapeF();
int cormatsize = coarse->NShapeF();
REAL error = 0.;
truerror = 0.;
REAL loclocmatstore[500] = {0.},loccormatstore[500] = {0.};
TPZFMatrix<REAL> loclocmat(locmatsize,locmatsize,loclocmatstore,500);
TPZFMatrix<REAL> loccormat(locmatsize,cormatsize,loccormatstore,500);
TPZAutoPointer<TPZIntPoints> intrule = fine->GetIntegrationRule().Clone();
int dimension = fine->Dimension();
int numdof = fine->Material()->NStateVariables();
TPZBlock<REAL> &locblock = fine->Mesh()->Block();
TPZFMatrix<REAL> &locsolmesh = fine->Mesh()->Solution();
TPZBlock<REAL> &corblock = coarse->Mesh()->Block();
TPZFMatrix<REAL> &corsolmesh = coarse->Mesh()->Solution();
TPZVec<REAL> locsol(numdof);
TPZFMatrix<REAL> locdsol(dimension,numdof);
TPZVec<REAL> corsol(numdof);
TPZFMatrix<REAL> cordsol(dimension,numdof);
TPZManVector<int> prevorder(dimension),
order(dimension);
intrule->GetOrder(prevorder);
TPZManVector<int> interpolation(dimension);
fine->GetInterpolationOrder(interpolation);
// compute the interpolation order of the shapefunctions squared
int dim;
int maxorder = interpolation[0];
for(dim=0; dim<interpolation.NElements(); dim++) {
maxorder = interpolation[dim] < maxorder ? maxorder : interpolation[dim];
}
for(dim=0; dim<dimension; dim++) {
order[dim] = 20;
}
intrule->SetOrder(order);
REAL locphistore[50]={0.},locdphistore[150]={0.};
TPZFMatrix<REAL> locphi(locmatsize,1,locphistore,50);
TPZFMatrix<REAL> locdphi(dimension,locmatsize,locdphistore,150),locdphix(dimension,locmatsize);
// derivative of the shape function
// in the master domain
REAL corphistore[50]={0.},cordphistore[150]={0.};
TPZFMatrix<REAL> corphi(cormatsize,1,corphistore,50);
TPZFMatrix<REAL> cordphi(dimension,cormatsize,cordphistore,150), cordphix(dimension,cormatsize);
// derivative of the shape function
// in the master domain
REAL jacobianstore[9],
axesstore[9];
TPZManVector<REAL> int_point(dimension),
coarse_int_point(dimension);
TPZFMatrix<REAL> jacfine(dimension,dimension,jacobianstore,9),jacinvfine(dimension,dimension);
TPZFMatrix<REAL> axesfine(3,3,axesstore,9);
TPZManVector<REAL> xfine(3);
TPZFMatrix<REAL> jaccoarse(dimension,dimension),jacinvcoarse(dimension,dimension);
TPZFMatrix<REAL> axescoarse(3,3), axesinner(dimension,dimension);
TPZManVector<REAL> xcoarse(3);
REAL jacdetcoarse;
int numintpoints = intrule->NPoints();
REAL weight;
int i,j,k;
TPZVec<REAL> truesol(numdof);
TPZFMatrix<REAL> truedsol(dimension,numdof);
for(int int_ind = 0; int_ind < numintpoints; ++int_ind) {
intrule->Point(int_ind,int_point,weight);
REAL jacdetfine;
fine->Reference()->Jacobian( int_point, jacfine , axesfine, jacdetfine, jacinvfine);
fine->Reference()->X(int_point, xfine);
if(f) f(xfine,truesol,truedsol);
fine->Shape(int_point,locphi,locdphi);
tr.Apply(int_point,coarse_int_point);
coarse->Shape(coarse_int_point,corphi,cordphi);
coarse->Reference()->Jacobian( coarse_int_point,jaccoarse,axescoarse, jacdetcoarse, jacinvcoarse);
coarse->Reference()->X(coarse_int_point,xcoarse);
REAL dist = (xfine[0]-xcoarse[0])*(xfine[0]-xcoarse[0])+(xfine[1]-xcoarse[1])*(xfine[1]-xcoarse[1])+(xfine[2]-xcoarse[2])*(xfine[2]-xcoarse[2]);
if(dist > 1.e-6) cout << "TPZMGAnalysis::ElementError transformation between fine and coarse is wrong\n";
for(i=0; i<dimension; i++) {
for(j=0; j<dimension; j++) {
axesinner(i,j) = 0.;
for(k=0; k<3; k++) axesinner(i,j) += axesfine(i,k)*axescoarse(j,k);
}
}
if(fabs(axesinner(0,0)-1.) > 1.e-6 || fabs(axesinner(1,1)-1.) > 1.e-6 || fabs(axesinner(0,1)) > 1.e-6 || fabs(axesinner(1,0)) > 1.e-6) {
//.........这里部分代码省略.........
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:101,代码来源:pzmganalysis.cpp
示例17: val1
void TPZMulticamadaOrthotropic::AddPlacaOrtho(TPZAutoPointer<TPZMaterial> material, REAL height){
TPZAutoPointer<TPZMaterial> bcptr;
fCompMesh->InsertMaterialObject(material);
TPZFNMatrix<9> val1(3,3,0.),val2(3,1,0.);
TPZBCTension *bc = new TPZBCTension(material,-material->Id()*4,4,val1,val2, 1., this,fPlacaOrth.NElements());
bcptr = TPZAutoPointer<TPZMaterial>(bc);
fCompMesh->InsertMaterialObject(bcptr);
bc = new TPZBCTension(material,-material->Id()*4-1,4,val1,val2, 1., this,fPlacaOrth.NElements());
bcptr = TPZAutoPointer<TPZMaterial>(bc);
fCompMesh->InsertMaterialObject(bcptr);
bc = new TPZBCTension(material,-material->Id()*4-2,4,val1,val2, -1., this,fPlacaOrth.NElements());
bcptr = TPZAutoPointer<TPZMaterial>(bc);
fCompMesh->InsertMaterialObject(bcptr);
bc = new TPZBCTension(material,-material->Id()*4-3,4,val1,val2, -1.,this,fPlacaOrth.NElements());
bcptr = TPZAutoPointer<TPZMaterial>(bc);
fCompMesh->InsertMaterialObject(bcptr);
// fPlacaOrth.Push(placa);
int nnodes = fGeoMesh->NodeVec().NElements();
fGeoMesh->NodeVec().Resize(nnodes+(fNelx+1)*(fNely+1));
int ix, iy;
TPZManVector<REAL,3> coord(3,fZMax+height);
fZMax += height;
for(ix=0; ix<= fNelx; ix++) {
for(iy=0; iy<= fNely; iy++) {
coord[0] = ix*fDx-fDx*REAL(fNelx/2.);
coord[1] = iy*fDy-fDy*REAL(fNely/2.);
fGeoMesh->NodeVec()[nnodes+ix+iy*(fNelx+1)].Initialize(coord,*fGeoMesh);
}
}
int nodebase1 = nnodes - (fNelx+1)*(fNely+1);
int elx, ely;
TPZManVector<int,8> nodeindexes(8,-1);
for(elx=0; elx<fNelx; elx++) {
for(ely=0; ely<fNely; ely++) {
nodeindexes[0] = nodebase1+elx+ely*(fNelx+1);
nodeindexes[1] = nodebase1+elx+1+ely*(fNelx+1);
nodeindexes[2] = nodebase1+elx+1+(ely+1)*(fNelx+1);
nodeindexes[3] = nodebase1+elx+(ely+1)*(fNelx+1);
int i;
for(i=0; i<4; i++) nodeindexes[i+4] = nodeindexes[i]+(fNelx+1)*(fNely+1);
int index;
TPZGeoEl *gel = fGeoMesh->CreateGeoElement (ECube, nodeindexes, material->Id(), index);
if(ely == 0) TPZGeoElBC gbc1(gel,21,-material->Id()*4);
if(elx == fNelx-1) TPZGeoElBC gbc2(gel,22,-material->Id()*4-1);
if(ely == fNely-1) TPZGeoElBC gbc3(gel,23,-material->Id()*4-2);
if(elx == 0) TPZGeoElBC gbc4(gel,24,-material->Id()*4-3);
int nplaca = fPlacaOrth.NElements();
if(nplaca == 0 && elx == 0 && ely == 0) {
TPZBndCond *bc2 = new TPZBndCond(material,-100,0,val1,val2);
bcptr = TPZAutoPointer<TPZMaterial>(bc2);
fCompMesh->InsertMaterialObject(bcptr);
TPZGeoElBC gbc5(gel,0,-100);
val1(0,0) = 1.e12;
val1(2,2) = 1.e12;
TPZBndCond *bc3 = new TPZBndCond(material,-101,2,val1,val2);
bcptr = TPZAutoPointer<TPZMaterial>(bc3);
fCompMesh->InsertMaterialObject(bcptr);
TPZGeoElBC gbc6(gel,3,-101);
val1.Zero();
val1(0,0) = 0.;
val1(2,2) = 1.e12;
TPZBndCond *bc4 = new TPZBndCond(material,-102,2,val1,val2);
bcptr = TPZAutoPointer<TPZMaterial>(bc4);
fCompMesh->InsertMaterialObject(bcptr);
TPZGeoElBC gbc7(gel,2,-102);
}
if(elx == fNelx/2 && ely == fNely/2) {
TPZPlacaOrthotropic placa(gel,fZMax-height,fZMax);
fPlacaOrth.Push(placa);
}
}
}
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:76,代码来源:TPZMulticamadaOrtho.cpp
示例18: 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
//.........这里部分代码省略.........
开发者ID:labmec,项目名称:neopz,代码行数:101,代码来源:substruct.cpp
示例19: InsertViscoElasticityCubo
void InsertViscoElasticityCubo(TPZAutoPointer<TPZCompMesh> mesh)
{
mesh->SetDimModel(3);
int nummat = 1, neumann = 1, mixed = 2;
// int dirichlet = 0;
int dir1 = -1, dir2 = -2, dir3 = -3, neumann1 = -4., neumann2 = -5, dirp2 = -6;
TPZManVector<STATE> force(3,0.);
//force[1] = 0.;
STATE ElaE = 1000., poissonE = 0.2, ElaV = 970., poissonV = 0.14;
STATE lambdaV = 0, muV = 0, alpha = 0, deltaT = 0;
lambdaV = 11.3636;
muV = 45.4545;
alpha = 1.;
deltaT = 0.1;
TPZViscoelastic *viscoelast = new TPZViscoelastic(nummat);
viscoelast->SetMaterialDataHooke(ElaE, poissonE, ElaV, poissonV, alpha, deltaT, force);
//TPZViscoelastic *viscoelast = new TPZViscoelastic(nummat, ElaE, poissonE, lambdaV, muV, alphaT, force);
//TPZElasticity3D *viscoelast = new TPZElasticity3D(nummat, ElaE, poissonE, force);
TPZFNMatrix<6> qsi(6,1,0.);
viscoelast->SetDefaultMem(qsi); //elast
int index = viscoelast->PushMemItem(); //elast
TPZMaterial * viscoelastauto(viscoelast);
mesh->InsertMaterialObject(viscoelastauto);
// Neumann em x = 1;
TPZFMatrix<STATE> val1(3,3,0.),val2(3,1,0.);
val2(0,0) = 1.;
TPZBndCond *bc4 = viscoelast->CreateBC(viscoelastauto, neumann1, neumann, val1, val2);
TPZMaterial * bcauto4(bc4);
mesh->InsertMaterialObject(bcauto4);
// Neumann em x = -1;
val2(0,0) = -1.;
TPZBndCond *bc5 = viscoelast->CreateBC(viscoelastauto, neumann2, neumann, val1, val2);
TPZMaterial * bcauto5(bc5);
mesh->InsertMaterialObject(bcauto5);
val2.Zero();
// Dirichlet em -1 -1 -1 xyz;
val1(0,0) = 1e4;
val1(1,1) = 1e4;
val1(2,2) = 1e4;
TPZBndCond *bc1 = viscoelast->CreateBC(viscoelastauto, dir1, mixed, val1, val2);
TPZMaterial * bcauto1(bc1);
mesh->InsertMaterialObject(bcauto1);
// Dirichlet em 1 -1 -1 yz;
val1(0,0) = 0.;
val1(1,1) = 1e4;
val1(2,2) = 1e4;
TPZBndCond *bc2 = viscoelast->CreateBC(viscoelastauto, dir2, mixed, val1, val2);
TPZMaterial * bcauto2(bc2);
mesh->InsertMaterialObject(bcauto2);
// Dirichlet em 1 1 -1 z;
val1(0,0) = 0.;
val1(1,1) = 0.;
val1(2,2) = 1e4;
TPZBndCond *bc3 = viscoelast->CreateBC(viscoelastauto, dir3, mixed, val1, val2);
TPZMaterial * bcauto3(bc3);
mesh->InsertMaterialObject(bcauto3);
}
开发者ID:labmec,项目名称:neopz,代码行数:67,代码来源:substruct.cpp
示例20: SetStructuralMatrix
void TPZAnalysis::SetStructuralMatrix(TPZAutoPointer<TPZStructMatrix> strmatrix){
fStructMatrix = TPZAutoPointer<TPZStructMatrix>(strmatrix->Clone());
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:3,代码来源:pzanalysis.cpp
注:本文中的TPZAutoPointer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论