78 template<
bool HAS_MIN,
bool HAS_MAX,
bool HAS_REVERT>
102 template<
bool HAS_MIN,
bool HAS_MAX,
bool HAS_REVERT>
110 float maxValue,
bool useRevertField,
float revertValue,
113 myUseMinField = useMinField;
115 myUseMaxField = useMaxField;
117 myUseRevertField = useRevertField;
118 myRevert = revertValue;
120 myBlendwidth = blendwidth;
129 inline float operator()(
float v,
float mv,
float Mv,
float rv)
const
131 bool clamped = clampBelow(v, mv) || clampAbove(v, Mv);
132 if(HAS_REVERT && clamped)
133 v = myUseRevertField ? rv : myRevert;
134 if(!clamped && myBlendwidth >=
MINBLEND)
135 v = limitBlend(v, mv, Mv, rv);
141 bool myUseMinField, myUseMaxField, myUseRevertField;
142 float myMin, myMax, myRevert;
148 inline bool clampBelow(
float&
v0,
float& mv)
const
165 inline bool clampAbove(
float& v0,
float& Mv)
const
181 inline float limitBlend(
float v,
float mv,
float Mv,
float rv)
const
185 if(HAS_MIN && HAS_MAX)
189 float bw = myBlendwidth * (Mv - mv);
190 d = SYSsmooth(mv, mv + bw, v) * (1 - SYSsmooth(Mv - bw, Mv, v));
192 rv = (v - mv < Mv -
v) ? mv : Mv;
196 d = SYSsmooth(mv, mv + myBlendwidth, v);
202 d = SYSsmooth(Mv - myBlendwidth, Mv, v);
207 if(HAS_REVERT && !myUseRevertField)
209 return d * v + (1 - d) * rv;
float operator()(float v, float mv, float Mv, float rv) const
#define DECLARE_STANDARD_GETCASTTOTYPE()
#define GET_DATA_FUNC_V3(DataName, FuncName)
GT_API const UT_StringHolder time
virtual bool solveGasSubclass(SIM_Engine &engine, SIM_Object *obj, SIM_Time time, SIM_Time timestep)=0
static constexpr float MINBLEND
Blend widths below this amount get clamped to 0.
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
bool shouldMultiThread(const UT_VoxelArrayF *field) const
#define GET_DATA_FUNC_I(DataName, FuncName)
const SIM_RawField * field
GAS_RevertOperation(bool useMinField, float minValue, bool useMaxField, float maxValue, bool useRevertField, float revertValue, float blendwidth)
THREADED_METHOD6_CONST(GAS_SubSolver, gdp->getNumPoints() > 2048, applyForces, GU_Detail *, gdp, const GA_PointGroup *, ptgrp, SIM_Time, timestep, bool, densityscale, bool, doorient, bool, updatepos) void applyForcesPartial(GU_Detail *gdp
#define GET_DATA_FUNC_F(DataName, FuncName)
GLint GLfloat GLint stencil
#define GET_DATA_FUNC_S(DataName, FuncName)
This class works as a functor to clamp/revert values.