MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / computeMatrixL

Function computeMatrixL

Tools/MeshSkinning/main.cpp:640–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

638
639
640void computeMatrixL()
641{
642 const int numParticles = (int) x0.size();
643
644 #pragma omp parallel default(shared)
645 {
646 #pragma omp for schedule(static)
647 for (int i = 0; i < numParticles; i++)
648 {
649 const Vector3r &xi0 = x0[i];
650 Matrix3r L_;
651 L_.setZero();
652
653 const size_t numNeighbors = initialNeighbors[i].size();
654
655 //////////////////////////////////////////////////////////////////////////
656 // Fluid
657 //////////////////////////////////////////////////////////////////////////
658 for (unsigned int j = 0; j < numNeighbors; j++)
659 {
660 const unsigned int neighborIndex = initialNeighbors[i][j];
661
662 const Vector3r &xj0 = x0[neighborIndex];
663 const Vector3r xj_xi_0 = xj0 - xi0;
664 const Vector3r gradW = gradKernelFct(xj_xi_0);
665
666 // minus because gradW(xij0) == -gradW(xji0)
667 L_ -= restVolumes[neighborIndex] * gradW * xj_xi_0.transpose();
668 }
669
670 //// add 1 to z-component. otherwise we get a singular matrix in 2D
671 //if (sim->is2DSimulation())
672 // L(2, 2) = 1.0;
673
674 bool invertible = false;
675 L_.computeInverseWithCheck(L[i], invertible, 1e-9);
676 if (!invertible)
677 {
678 //MathFunctions::pseudoInverse(L, m_L[i]);
679 L[i] = Matrix3r::Identity();
680 }
681 }
682 }
683}
684
685#ifdef USE_AVX
686

Callers 4

initValuesMethod · 0.85
initValuesMethod · 0.85
initValuesMethod · 0.85
initFunction · 0.85

Calls 4

sizeMethod · 0.45
setZeroMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected