Skip to content
Snippets Groups Projects
Commit 2dbe9c5f authored by Patrick M. Jensen's avatar Patrick M. Jensen
Browse files

Subtract 1 from frozen vertex indices

Since MATLAB uses 1-indexing we need to adjust the indices.
parent fe05ae05
Branches
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
#include <thread>
#include <memory>
#include <cmath>
#include <algorithm>
#include "mex.h"
#include "matrix.h"
......@@ -60,6 +61,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
// TODO: This ends up doing unnecessary allocation, copying, and freeing. Check added overhead.
Volume<int> frozenVertVol = getCastVolumeChecked<int>(prhs[7], "FrozenVertices");
frozenVerts.assign(frozenVertVol.data.get(), frozenVertVol.data.get() + frozenVertVol.numElem());
std::transform(frozenVerts.begin(), frozenVerts.end(), frozenVerts.begin(),
[](auto x) { return x - 1; }); // Subtract 1 since MATLAB uses 1-indexing
}
size_t nverts = vertVol.nx;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment