本文整理汇总了C++中SparseMatrix::GetNumRows方法的典型用法代码示例。如果您正苦于以下问题:C++ SparseMatrix::GetNumRows方法的具体用法?C++ SparseMatrix::GetNumRows怎么用?C++ SparseMatrix::GetNumRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SparseMatrix
的用法示例。
在下文中一共展示了SparseMatrix::GetNumRows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
int
BilinearPatchBuilder::convertToPatchType(SourcePatch const & sourcePatch,
PatchDescriptor::Type patchType,
SparseMatrix<float> & matrix) const {
assert("Conversion from Bilinear patches to other bases not yet supported" == 0);
// For suppressing warnings until implemented...
if (sourcePatch.GetNumSourcePoints() == 0) return -1;
if (patchType == PatchDescriptor::NON_PATCH) return -1;
if (matrix.GetNumRows() <= 0) return -1;
return -1;
}
示例2: main
int main(int argc, char* argv[])
{
char* inputFileName = "I:/Programs/VegaFEM-v2.1/models/turtle/turtle-volumetric-homogeneous.veg";
VolumetricMesh* volumetricMesh = VolumetricMeshLoader::load(inputFileName);
if (volumetricMesh == NULL)
{
PRINT_F("load failed!");
}
else
{
PRINT_F("%d vertices, %d elements", volumetricMesh->getNumVertices(), volumetricMesh->getNumElements());
}
TetMesh* tetMesh;
if (volumetricMesh->getElementType() == VolumetricMesh::TET)
{
tetMesh = (TetMesh*) volumetricMesh;
}
else
PRINT_F("not a tet mesh\n");
CorotationalLinearFEM* deformableModel = new CorotationalLinearFEM(tetMesh);
ForceModel* forceModel = new CorotationalLinearFEMForceModel(deformableModel);
int nVtx = tetMesh->getNumVertices();
int r = 3 * nVtx;
double timestep = 0.0333;
SparseMatrix* massMatrix;
GenerateMassMatrix::computeMassMatrix(tetMesh, &massMatrix, true);
massMatrix->SaveToMatlabFormat("massMatrix.m");
PRINT_F("%d rows, %d cols\n", massMatrix->GetNumRows(), massMatrix->GetNumColumns());
int positiveDefiniteSolver = 0;
int numConstrainedDOFs = 9;
int constrainedDOFs[9]= {12,13,14,30,31,32,42,43,44};
double dampingMassCoef = 0.0;
double dampingStiffnessCoef = 0.01;
ImplicitBackwardEulerSparse* integrator = new ImplicitBackwardEulerSparse(r, timestep, massMatrix, forceModel, positiveDefiniteSolver, numConstrainedDOFs, constrainedDOFs, dampingMassCoef, dampingStiffnessCoef);
//CentralDifferencesSparse* integrator = new CentralDifferencesSparse(r, timestep, massMatrix, forceModel, numConstrainedDOFs, constrainedDOFs, dampingMassCoef, dampingStiffnessCoef);
double * f = new double[r];
int numTimesteps = 10;
double*u = new double[r];
for (int i = 0; i < numTimesteps; ++i)
{
integrator->SetExternalForcesToZero();
if (i==0)
{
for (int j = 0; j < r; j++)
f[j] = 0;
f[37] = -500;
integrator->SetExternalForces(f);
}
integrator->GetqState(u);
PRINT_F("v = [", i);
for (int ithVtx = 0; ithVtx < nVtx; ++ithVtx)
PRINT_F("%lf, %lf, %lf\n", u[ithVtx*3],u[ithVtx*3+1],u[ithVtx*3+2]);
PRINT_F("];");
integrator->DoTimestep();
}
return 0;
}