本文整理汇总了C++中TPZFMatrix::Resize方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZFMatrix::Resize方法的具体用法?C++ TPZFMatrix::Resize怎么用?C++ TPZFMatrix::Resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPZFMatrix
的用法示例。
在下文中一共展示了TPZFMatrix::Resize方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GradX
inline void TPZQuadraticQuad::GradX(const TPZFMatrix<REAL> &nodes,TPZVec<T> &loc, TPZFMatrix<T> &gradx){
gradx.Resize(3,2);
gradx.Zero();
int nrow = nodes.Rows();
int ncol = nodes.Cols();
#ifdef PZDEBUG
if(nrow != 3 || ncol != 8){
std::cout << "Objects of incompatible lengths, gradient cannot be computed." << std::endl;
std::cout << "nodes matrix must be 3x8." << std::endl;
DebugStop();
}
#endif
TPZFNMatrix<3,T> phi(NNodes,1);
TPZFNMatrix<6,T> dphi(2,NNodes);
TShape(loc,phi,dphi);
for(int i = 0; i < NNodes; i++)
{
for(int j = 0; j < 3; j++)
{
gradx(j,0) += nodes.GetVal(j,i)*dphi(0,i);
gradx(j,1) += nodes.GetVal(j,i)*dphi(1,i);
}
}
}
示例2: ExtractMatrix
void TPBrCellMarx::ExtractMatrix(TPZManVector<REAL> &input, TPZFMatrix<REAL> &output)
{
output.Resize(input.NElements(), 1);
int i;
for (i=0; i<input.NElements(); i++) {
output(i,0) = input[i];
}
}
示例3: SolExataU
void SolExataU(const TPZVec<REAL> &pt, TPZVec<STATE> &solU, TPZFMatrix<STATE> &GradU){
double x = pt[0];
GradU.Resize(2, 1);
solU[0]= 4.*x - 4.*x*x;
GradU(0,0) = 4.-8.*x;
GradU(1,0) = 0.;
}
示例4: SolSuave
void SolSuave(const TPZVec<REAL> &loc, TPZVec<STATE> &u, TPZFMatrix<STATE> &du){
const REAL x = loc[0];
const REAL y = loc[1];
const REAL sol = /*x*(1.-x)*y*(1.-y);*/sin(M_PI*x)*sin(M_PI*y);
u[0] = sol;
du.Resize(2, 1);
du(0,0) = /*(1. - x)*(1. - y)*y - x*(1. - y)*y;*/M_PI*cos(M_PI*x)*sin(M_PI*y);
du(1,0) = /*(1. - x)*x*(1. - y) - (1. - x)*x*y;*/M_PI*cos(M_PI*y)*sin(M_PI*x);
}
示例5: SolExataP
void SolExataP(const TPZVec<REAL> &pt, TPZVec<STATE> &solP, TPZFMatrix<STATE> &GradP){
REAL x = pt[0];
REAL y = pt[1];
GradP.Resize(2, 1);
solP[0]= sin(M_PI*x)*sin(M_PI*y);
GradP(0,0) = M_PI*cos(M_PI*x)*sin(M_PI*y);
GradP(1,0) = M_PI*cos(M_PI*y)*sin(M_PI*x);
}
示例6: Jacobian
void TPZGeoTriangle::Jacobian(TPZFMatrix<REAL> & coord, TPZVec<REAL> ¶m,TPZFMatrix<REAL> &jacobian,TPZFMatrix<REAL> &axes,REAL &detjac,TPZFMatrix<REAL> &jacinv) {
int spacedim = coord.Rows();
jacobian.Resize(2,2);
axes.Resize(2,3);
jacinv.Resize(2,2);
TPZFNMatrix<3> phi(3,1);
TPZFNMatrix<6> dphi(2,3),axest(3,2);
jacobian.Zero();
Shape(param,phi,dphi);
TPZFNMatrix<6> VecMatrix(3,2,0.);
for(int i = 0; i < 3; i++) {
for(int j = 0; j < spacedim; j++) {
VecMatrix(j,0) += coord(j,i)*dphi(0,i);
VecMatrix(j,1) += coord(j,i)*dphi(1,i);
}
}
VecMatrix.GramSchmidt(axest,jacobian);
axest.Transpose(&axes);
detjac = jacobian(0,0)*jacobian(1,1)-jacobian(1,0)*jacobian(0,1);
if(IsZero(detjac))
{
std::stringstream sout;
sout << "Singular Jacobian " << detjac;
LOGPZ_ERROR(logger, sout.str())
detjac = ZeroTolerance();
}
if(detjac)
{
jacinv(0,0) = jacobian(1,1)/detjac;
jacinv(1,1) = jacobian(0,0)/detjac;
jacinv(0,1) = -jacobian(0,1)/detjac;
jacinv(1,0) = -jacobian(1,0)/detjac;
}
else
{
jacinv.Zero();
}
}
示例7: EstadoAd
void EstadoAd(const TPZVec<REAL> &loc, TPZVec<STATE> &u, TPZFMatrix<STATE> &du){
const REAL x = loc[0];
const REAL y = loc[1];
u.Resize(1, 0.);
du.Resize(3, 1.);
du(0,0)=du(1,0)=du(2,0)=0.;
//const REAL alpha=0.001;
const REAL sol = 10.*x*y*(1-x)*(1-y);
u[0] = sol;
}
示例8: BuildMe
void OOPParMatrix::BuildMe(int size, TPZMatrix<REAL> * matrix, TPZFMatrix<REAL> & vU)
{
matrix->Resize(size, size);
int i, j;
vU.Resize(size, 1);
for(i = 0; i < size; i++)
{
double value;
for(j=0; j < size; j++)
{
value = rand()/1e8;
matrix->Put(i, j, value);
}
vU.Put(i, 0,value * 1.4);
}
}
示例9: Sort
void TPZErrorIndicator::Sort(TPZFMatrix &error, TPZFMatrix &perm) {
int i,j,k;
int imin = 0;
int imax = error.Rows();
perm.Resize(imax,error.Cols());
for (i=0;i<imax;i++)
for (j=0;j<error.Cols();j++) perm(i,j) = i;
for(i=imin; i<imax; i++) {
for(j=i+1; j<imax; j++) {
for (k=0;k<error.Cols();k++){
if(error((int)perm(i,k)) < error((int)perm(j,k))) {
int kp = (int) perm(i,k);
perm(i,k) = perm(j,k);
perm(j,k) = kp;
}
}
}
}
}
示例10: MapToSide
bool TPZPrism::MapToSide(int side, TPZVec<T> &InternalPar, TPZVec<T> &SidePar, TPZFMatrix<T> &JacToSide) {
double zero = 1.E-5;
T qsi = InternalPar[0];
T eta = InternalPar[1];
T zeta = InternalPar[2];
bool regularmap = true;
switch(side)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
{
SidePar.Resize(0); JacToSide.Resize(0,0);
break;
}
case 6://1D
SidePar.Resize(1);
JacToSide.Resize(1,3);
if(fabs((T)(eta-1.)) < zero)
{
SidePar[0] = 0.;
JacToSide(0,0) = 1.;
JacToSide(0,1) = 1.;
JacToSide(0,2) = 0.;
regularmap = false;
}
else
{
SidePar[0] = 2.*qsi/(1.-eta) - 1.;
JacToSide(0,0) = 2./(1.-eta); JacToSide(0,1) = 2.*qsi/((1.-eta)*(1.-eta)); JacToSide(0,2) = 0.;
}
break;
case 7://1D
SidePar.Resize(1); JacToSide.Resize(1,3);
if(fabs((T)(qsi+eta)) < zero)
{
SidePar[0] = 0.;
JacToSide(0,0) = 1.;
JacToSide(0,1) = 1.;
JacToSide(0,2) = 0.;
regularmap = false;
}
else
{
SidePar[0] = 1. - 2.*qsi/(qsi + eta);
JacToSide(0,0) = -2.*eta/((qsi+eta)*(qsi+eta)); JacToSide(0,1) = 2.*qsi/((qsi+eta)*(qsi+eta)); JacToSide(0,2) = 0.;
}
break;
case 8://1D
SidePar.Resize(1); JacToSide.Resize(1,3);
if(fabs((T)(qsi-1.)) < zero)
{
SidePar[0] = 0.;
JacToSide(0,0) = 1.; JacToSide(0,1) = 1.; JacToSide(0,2) = 0.;
regularmap = false;
}
else
{
SidePar[0] = 1. - 2.*eta/(1.-qsi);
JacToSide(0,0) = -2.*eta/((1.-qsi)*(1.-qsi)); JacToSide(0,1) = -2./(1.-qsi); JacToSide(0,2) = 0.;
}
break;
case 9://1D
SidePar.Resize(1); JacToSide.Resize(1,3);
SidePar[0] = zeta;
JacToSide(0,0) = 0.; JacToSide(0,1) = 0.; JacToSide(0,2) = 1.;
break;
case 10://1D
SidePar.Resize(1); JacToSide.Resize(1,3);
SidePar[0] = zeta;
JacToSide(0,0) = 0.; JacToSide(0,1) = 0.; JacToSide(0,2) = 1.;
break;
case 11://1D
SidePar.Resize(1); JacToSide.Resize(1,3);
SidePar[0] = zeta;
JacToSide(0,0) = 0.; JacToSide(0,1) = 0.; JacToSide(0,2) = 1.;
break;
case 12://1D
SidePar.Resize(1); JacToSide.Resize(1,3);
if(fabs((T)(eta-1.)) < zero)
{
SidePar[0] = 0.;
JacToSide(0,0) = 1.; JacToSide(0,1) = 1.; JacToSide(0,2) = 0.;
regularmap = false;
}
else
{
SidePar[0] = 2.*qsi/(1.-eta) - 1.;
JacToSide(0,0) = 2./(1.-eta); JacToSide(0,1) = 2.*qsi/((1.-eta)*(1.-eta)); JacToSide(0,2) = 0.;
//.........这里部分代码省略.........
示例11: MapToSide
bool TPZPoint::MapToSide(int side, TPZVec<T> &InternalPar, TPZVec<T> &SidePar, TPZFMatrix<T> &JacToSide) {
SidePar.Resize(0); JacToSide.Resize(0,0);
return true;
}
示例12: VecHdiv
void TPZGeoTriangle::VecHdiv(TPZFMatrix<REAL> & coord, TPZFMatrix<REAL> & fNormalVec,TPZVec<int> &fVectorSide) {
if(coord.Rows()!=3)
{
cout<< "Erro na dimens�o das linhas de coord"<< endl;
}
if(coord.Cols()!=3)
{
cout<< "Erro na dimens�o das colunas de coord"<< endl;
}
TPZVec<REAL> p1(3), p2(3), p3(3),result(3);
for(int j=0; j<3; j++)
{
p1[j]=coord(j,0);
p2[j]=coord(j,1);
p3[j]=coord(j,2);
}
fNormalVec.Resize(14, 3);
fVectorSide.Resize(14);
int count=0;
//primeira face
for(int j=0; j<3; j++) //v0
{
fNormalVec(0,j) = coord(j,0)- coord(j,2);
}
fVectorSide[count]=0;
count++;
for(int j=0; j<3; j++) //v1
{
fNormalVec(1,j) = coord(j,1)- coord(j,2);
}
fVectorSide[count]=1;
count++;
//v2
ComputeNormal(p1,p2,p3,result);
fNormalVec(2,0) = -result[0];
fNormalVec(2,1) = -result[1];
fNormalVec(2,2) = -result[2];
fVectorSide[count]=3;
count++;
//segunda face
for(int j=0; j<3; j++) //v3
{
fNormalVec(3,j) = coord(j,1)- coord(j,0);
}
fVectorSide[count]=1;
count++;
for(int j=0; j<3; j++) //v4
{
fNormalVec(4,j) = coord(j,2)- coord(j,0);
}
fVectorSide[count]=2;
count++;
//v5
ComputeNormal(p2,p3,p1,result);
fNormalVec(5,0) = -result[0];
fNormalVec(5,1) = -result[1];
fNormalVec(5,2) = -result[2];
fVectorSide[count]=4;
count++;
//terceira face
for(int j=0; j<3; j++) //v6
{
fNormalVec(6,j) = coord(j,2)- coord(j,1);
}
fVectorSide[count]=2;
count++;
for(int j=0; j<3; j++) //v7
{
fNormalVec(7,j) = coord(j,0)- coord(j,1);
}
fVectorSide[count]=0;
count++;
//v8
ComputeNormal(p3,p1,p2,result);
fNormalVec(8,0) = -result[0];
fNormalVec(8,1) = -result[1];
fNormalVec(8,2) = -result[2];
fVectorSide[count]=5;
count++;
// internos tangentes
for(int j=0; j<3; j++) //v9
{
fNormalVec(9,j) = coord(j,1)- coord(j,0);
}
fVectorSide[count]=3;
count++;
for(int j=0; j<3; j++) //v10
{
fNormalVec(10,j) = coord(j,2)- coord(j,1);
}
fVectorSide[count]=4;
count++;
for(int j=0; j<3; j++) //v11
{
fNormalVec(11,j) = coord(j,0)- coord(j,2);
}
fVectorSide[count]=5;
count++;
//.........这里部分代码省略.........
示例13: MapToSide
bool TPZGeoTriangle::MapToSide(int side, TPZVec<REAL> &InternalPar, TPZVec<REAL> &SidePar, TPZFMatrix<REAL> &JacToSide) {
double zero = 1.E-5;
REAL qsi = InternalPar[0];
REAL eta = InternalPar[1];
SidePar.Resize(1);
JacToSide.Resize(1,2);
if((qsi + eta - 1.) > 1.e-5 || qsi < -1.e-5 || eta < -1.e-5)
{
cout << "Point (qsi,eta) = (" << qsi << "," << eta << ") is out of TPZGeoTriangle Master Element Range!\n";
cout << "See TPZGeoTriangle::MapToSide() method!\n";
DebugStop();
}
if(qsi < 0.) qsi = 0.;
if(eta < 0.) eta = 0.;
if(qsi+eta > 1.)
{
REAL qsieta = 1.-qsi-eta;
qsi += qsieta/2.;
eta += qsieta/2.;
}
bool regularmap = true;
switch(side)
{
case 3:
if(fabs(eta - 1.) < zero)
{
SidePar[0] = 0.;
JacToSide(0,0) = 0.;
JacToSide(0,1) = 0.;
regularmap = false;
}
else
{
SidePar[0] = 2.*qsi/(1.-eta) - 1.;
JacToSide(0,0) = 2./(1.-eta);
JacToSide(0,1) = 2.*qsi/((1.-eta)*(1.-eta));
}
break;
case 4:
if(qsi+eta < zero)
{
SidePar[0] = 0.;
JacToSide(0,0) = 0.;
JacToSide(0,1) = 0.;
regularmap = false;
}
else
{
SidePar[0] = 1. - 2.*qsi/(qsi + eta);
JacToSide(0,0) = -2.*eta/((qsi+eta)*(qsi+eta));
JacToSide(0,1) = 2.*qsi/((qsi+eta)*(qsi+eta));
}
break;
case 5:
if(fabs(qsi - 1.) < zero)
{
SidePar[0] = 0.;
JacToSide(0,0) = 0.;
JacToSide(0,1) = 0.;
regularmap = false;
}
else
{
SidePar[0] = 1. - 2.*eta/(1.-qsi);
JacToSide(0,0) = -2.*eta/((1.-qsi)*(1.-qsi));
JacToSide(0,1) = -2./(1.-qsi);
}
break;
}
if(side < 3 || side > 5)
{
cout << "Cant compute MapToSide method in TPZGeoTriangle class!\nParameter (SIDE) must be 3, 4 or 5!\nMethod Aborted!\n";
DebugStop();
}
return regularmap;
}
示例14:
/**
* Calcula os valores das funcoes de forma e suas derivadas
* @point ponto onde calcular as funcoes de forma
* @phi valores das funcoes de forma
* @dphi valores das derivadas das funcoes de forma
*/
void TElemento0d::Shape(std::vector<double> &point, std::vector<double> &phi, TPZFMatrix &dphi)
{
phi.resize(1);
phi[0] = 1.;
dphi.Resize(0,1);
}