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

Function precomputeValues

Tools/MeshSkinning/main.cpp:841–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

839
840
841void precomputeValues()
842{
843 const int numParticles = (int)activeParticles.size();
844 unsigned int numVertices = mesh.numVertices();
845 auto& meshX0 = mesh.getVertices();
846
847#ifdef USE_AVX
848 precomputed_indices8.clear();
849 precomp_V_gradW8.clear();
850 precomputed_indices8.resize(numParticles);
851#else
852 precomputed_indices.clear();
853 precomp_V_gradW.clear();
854 precomputed_indices.resize(numParticles);
855#endif
856
857
858 unsigned int sumNeighborParticles = 0;
859 unsigned int sumNeighborParticles8 = 0;
860 for (int i = 0; i < numParticles; i++)
861 {
862 const unsigned int index = activeParticles[i];
863 const size_t numNeighbors = initialNeighbors[index].size();
864
865#ifdef USE_AVX
866 precomputed_indices8[i] = sumNeighborParticles8;
867
868 // steps of 8 values due to avx
869 sumNeighborParticles8 += (unsigned int) numNeighbors / 8u;
870 if (numNeighbors % 8 != 0)
871 sumNeighborParticles8++;
872#else
873 precomputed_indices[i] = sumNeighborParticles;
874 sumNeighborParticles += (int) numNeighbors;
875#endif
876 }
877
878#ifdef USE_AVX
879 precomp_V_gradW8.resize(sumNeighborParticles8);
880#else
881 precomp_V_gradW.resize(sumNeighborParticles);
882#endif
883
884 #pragma omp parallel default(shared)
885 {
886 #pragma omp for schedule(static)
887 for (int i = 0; i < (int)numParticles; i++)
888 {
889 const unsigned int index = activeParticles[i];
890 const Vector3r& xi0 = x0[index];
891 const unsigned int numNeighbors = (unsigned int)initialNeighbors[index].size();
892
893#ifdef USE_AVX
894 const Vector3f8 xi0_avx(xi0);
895 unsigned int base8 = precomputed_indices8[i];
896 unsigned int idx = 0;
897 Matrix3f8 L_avx(L[index]);
898 for (unsigned int j = 0; j < numNeighbors; j += 8)

Callers 10

stepMethod · 0.85
stepMethod · 0.85
stepElasticitySolverMethod · 0.85
stepVolumeSolverMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
stepMethod · 0.85
initFunction · 0.85

Calls 7

minFunction · 0.85
convert_zeroFunction · 0.85
convertVec_zeroFunction · 0.85
numVerticesMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected