Skip to content

Commit d1303d6

Browse files
committed
Added: Option to always ignore the first element(s) in the patch
1 parent 9a73525 commit d1303d6

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/Utility/Functions.C

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ IntFunc* utl::parseIntFunc (const std::string& func, const std::string& type)
868868
// of nv/nw elements, which then are activated one by one.
869869
class Parametric : public IntFunc
870870
{
871+
int n0; // Always ignore the first n0 elements
871872
int nu; // Number of elements in first parameter direction
872873
int nv; // Number of elements to activate in v-w plane before advancing in u
873874
int nw; // Number of element divisions per layer in w-direction
@@ -876,13 +877,15 @@ IntFunc* utl::parseIntFunc (const std::string& func, const std::string& type)
876877

877878
public:
878879
explicit Parametric(int u, int v, int w, Real scale)
879-
: nu(u), nv(v), nw(w), s(scale), t(Real(0)) {}
880-
explicit Parametric(int u, Real offset, Real scale)
881-
: nu(u), nv(1), nw(1), s(scale), t(offset) {}
880+
: n0(0), nu(u), nv(v), nw(w), s(scale), t(Real(0)) {}
881+
explicit Parametric(int ignore_init, int u, Real offset, Real scale)
882+
: n0(ignore_init), nu(u), nv(1), nw(1), s(scale), t(offset) {}
882883

883884
protected:
884885
Real evaluate(const int& x) const override
885886
{
887+
if (x <= n0) return Real(1.0e99); // always ignore this element
888+
886889
int ix = (x-1)%nu;
887890
int nx = (x-1)/nu;
888891
if (ix < 1 && nx < nv) return t;
@@ -911,8 +914,9 @@ IntFunc* utl::parseIntFunc (const std::string& func, const std::string& type)
911914
int ne1 = atoi(strtok(prms," "));
912915
Real ts = (s = strtok(nullptr," ")) ? atof(s) : Real(0);
913916
Real sf = (s = strtok(nullptr," ")) ? atof(s) : Real(1);
917+
int ne0 = (s = strtok(nullptr," ")) ? atoi(s) : 0;
914918
free(prms);
915-
return new Parametric(ne1,ts,sf);
919+
return new Parametric(ne0,ne1,ts,sf);
916920
}
917921

918922
Real scaling(1);

0 commit comments

Comments
 (0)