added option for computing biharmonic field

This commit is contained in:
Luigi Malomo 2016-03-23 17:08:22 +00:00
parent 24fe5cb6a0
commit 0aec75be39
1 changed files with 8 additions and 1 deletions

View File

@ -55,7 +55,7 @@ public:
* @note the algorithm has unexpected behavior if the mesh contains unreferenced vertices.
*/
template <typename ACCESSOR>
static bool ComputeScalarField(MeshType & m, const ConstraintVec & constraints, ACCESSOR field)
static bool ComputeScalarField(MeshType & m, const ConstraintVec & constraints, ACCESSOR field, bool biharmonic = false)
{
typedef Eigen::SparseMatrix<CoeffScalar> SpMat; // sparse matrix type
typedef Eigen::Triplet<CoeffScalar> Triple; // triplet type to fill the matrix
@ -115,6 +115,13 @@ public:
}
laplaceMat.setFromTriplets(coeffs.begin(), coeffs.end());
if (biharmonic)
{
SpMat lap_t = laplaceMat;
lap_t.transpose();
laplaceMat = lap_t * laplaceMat;
}
// Setting the constraints
const CoeffScalar alpha = pow(10.0, 8.0); // penalty factor alpha