32 bool Foam::functionObjects::randomise::calcRandomised()
34 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
38 const VolFieldType& field = lookupObject<VolFieldType>(
fieldName_);
40 tmp<VolFieldType> rfieldt(
new VolFieldType(field));
41 VolFieldType& rfield = rfieldt.ref();
47 Type rndPert = rand.sample01<Type>();
48 rndPert = 2.0*rndPert - pTraits<Type>::one;
49 rndPert /=
mag(rndPert);
50 rfield[celli] += magPerturbation_*rndPert;
#define forAll(list, i)
Loop across all elements in list.
word resultName_
Name of result field.
const word fieldName_
Name of field to process.
bool store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
dimensioned< scalar > mag(const dimensioned< Type > &)