From aa2649b20472135cb96f8d97fa4c2cb465f8364a Mon Sep 17 00:00:00 2001 From: sunwen Date: Mon, 12 Jun 2023 11:40:24 +0800 Subject: [PATCH] Add meshgridInterp3. --- src/Function3D.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++++++ src/Function3D.h | 1 + 2 files changed, 84 insertions(+) diff --git a/src/Function3D.cpp b/src/Function3D.cpp index 62181ce..f2b4ae3 100644 --- a/src/Function3D.cpp +++ b/src/Function3D.cpp @@ -123,3 +123,86 @@ int Aurora::size(const Matrix &aMatrix,int dims) { return aMatrix.getDimSize(dims-1); } + +Matrix Aurora::meshgridInterp3(const Matrix& aX, const Matrix& aY, const Matrix& aZ, const Matrix& aV, const Matrix& aX1, const Matrix& aY1, const Matrix& aZ1,InterpnMethod aMethod, double aExtrapval) +{ + std::vector zTemps; + for(int rIndex=0; rIndex yTemps; + for(int xIndex=0; xIndex xTemps; + for(int yIndex=0; yIndex resultVector; + for(int i=0; i maxXSOS || + aY1[yIndex] < minYSOS || aY1[yIndex] > maxYSOS || + aZ1[zIndex] < minZSOS || aZ1[zIndex] > maxZSOS) + { + result[index] = aExtrapval; + } + } + } + } + + return result; +} diff --git a/src/Function3D.h b/src/Function3D.h index 17bc282..1a8a3f6 100644 --- a/src/Function3D.h +++ b/src/Function3D.h @@ -39,6 +39,7 @@ namespace Aurora { */ Matrix zeros(int aSquareRow); Matrix interp3(const Matrix& aX, const Matrix& aY, const Matrix& aZ, const Matrix& aV, const Matrix& aX1, const Matrix& aY1, const Matrix& aZ1,InterpnMethod aMethod); + Matrix meshgridInterp3(const Matrix& aX, const Matrix& aY, const Matrix& aZ, const Matrix& aV, const Matrix& aX1, const Matrix& aY1, const Matrix& aZ1,InterpnMethod aMethod, double aExtrapval); Matrix interpn(const Matrix& aX, const Matrix& aY, const Matrix& aZ, const Matrix& aV, const Matrix& aX1, const Matrix& aY1, const Matrix& aZ1,InterpnMethod aMethod); Matrix size(const Matrix &aMatrix);