43 return result/l.
size();
52 template<
class Container>
56 typename Container::value_type nResult =
78 template<
class Op,
class Tuple,
class Int, Int ... Is>
82 const std::integer_sequence<Int, Is ...>&,
86 return std::make_tuple(op(std::get<Is>(tuple)) ...);
90 template<
class Op,
class ... Types>
91 auto tupleOp(
const std::tuple<Types...>& tuple,
const Op& op)
93 return tupleOp(tuple, std::make_index_sequence<
sizeof ... (Types)>(), op);
127 template<
class ScaleType>
145 template<
class Op,
class Tuple,
class Int, Int ... Is>
149 const std::integer_sequence<Int, Is ...>&,
153 (void)std::initializer_list<nil>
155 op(std::get<Is>(tuple)),
161 template<
class Op,
class ... Types>
164 tupleInPlaceOp(tuple, std::make_index_sequence<
sizeof ... (Types)>(), op);
178 template<
class BinaryOp,
class Tuple,
class Int, Int ... Is>
183 const std::integer_sequence<Int, Is ...>&,
187 return std::make_tuple(bop(std::get<Is>(tupleA), std::get<Is>(tupleB)) ...);
191 template<
class BinaryOp,
class ... TypesA,
class ... TypesB>
194 const std::tuple<TypesA ...>& tupleA,
195 const std::tuple<TypesB ...>& tupleB,
203 std::make_index_sequence<
sizeof ... (TypesA)>(),
223 template<
template<
class>
class FaceValues,
class ... Types>
231 const FaceValues<point>& fPs,
233 const std::tuple<FaceValues<Types> ...>& fPsis,
234 const std::tuple<Types ...>& fPsiAvg
241 typename FaceValues<point>::const_iterator fPIter(fPs.begin());
242 auto fPsiIter =
tupleOp(fPsis, OpBegin());
244 for(; fPIter != fPs.end(); ++ fPIter)
246 const point p0 = *fPIter;
247 const point p1 = fPIter.next();
248 auto psi0 =
tupleOp(fPsiIter, OpDereference());
249 auto psi1 =
tupleOp(fPsiIter, OpNext());
251 const vector a = ((p1 - p0)^(fPAvg - p0))/2;
265 auto av =
tupleOp(v, OpScaled<vector>(a/3));
268 fCutsAreaPsi =
tupleBinaryOp(fCutsAreaPsi, av, BinaryOpAdd());
273 return std::tuple_cat(std::tuple<vector>(fCutsArea), fCutsAreaPsi);
288 const List<labelPair>& fCuts,
290 const Field<Type>& pPsis,
292 const scalar isoAlpha,
300 if (fCuts.size() == 0)
302 if ((pAlphas[
f[0]] < isoAlpha) == below)
304 return Tuple2<vector, IntegralType>(fArea, fArea*fPsi);
308 return Tuple2<vector, IntegralType>(
Zero,
Zero);
315 cutPoly::FaceCutValues<vector>
327 cutPoly::FaceCutValues<Type>
341 Tuple2<vector, IntegralType>
353 const cellEdgeAddressing& cAddr,
354 const scalar cVolume,
364 const Field<Type>& pPsis,
366 const scalar isoAlpha,
372 if (cCuts.size() == 0)
374 if ((pAlphas[fs[
c[0]][0]] < isoAlpha) == below)
376 return Tuple2<scalar, Type>(cVolume, cVolume*cPsi);
380 return Tuple2<scalar, Type>(0,
Zero);
386 const Type cPsiAvg =
average(fPsis,
c);
389 scalar cCutsVolume = 0;
390 Type cCutsVolumePsi =
Zero;
401 const vector& fBaseP = fCentres[
c[cfi]];
403 const scalar pyrVolume =
404 (cAddr.cOwns()[cfi] ? +1 : -1)
405 *(fCutAreas[
c[cfi]] & (fBaseP - cPAvg))/3;
407 cCutsVolume += pyrVolume;
408 cCutsVolumePsi += pyrVolume*(3*fCutPsis[
c[cfi]] + cPsiAvg)/4;
413 const cutPoly::CellCutValues<point> cPValues
424 const cutPoly::CellCutValues<Type> cPsiValues
483 const vector& fCutArea = std::get<0>(fSumPPsis);
487 const scalar pyrVolume =
488 (below ? +1 : -1)*(fCutArea & (fCutCentre - cPAvg))/3;
490 cCutsVolume += pyrVolume;
491 cCutsVolumePsi += pyrVolume*(3*fCutPsi + cPsiAvg)/4;
494 return Tuple2<scalar, Type>(cCutsVolume, cCutsVolumePsi);
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 2-tuple for storing two objects of different types.
A List with indirect addressing.
label size() const
Return the number of elements in the list.
A zero-sized class without any storage. Used, for example, in HashSet.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Traits class for primitives.
volScalarField scalarField(fieldObject, mesh)
volVectorField vectorField(fieldObject, mesh)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const dimensionedScalar c
Speed of light in a vacuum.
auto tupleOp(const std::tuple< Types... > &tuple, const Op &op)
Type average(const UIndirectList< Type > &l)
std::tuple< vector, typename outerProduct< vector, Types >::type ... > faceAreaIntegral(const FaceValues< point > &fPs, const point &fPAvg, const std::tuple< FaceValues< Types > ... > &fPsis, const std::tuple< Types ... > &fPsiAvg)
Compute the face-area and face-area-integrals of the given properties over.
Container::value_type iterableAverage(const Container &xs)
Tuple2< scalar, Type > cellCutVolumeIntegral(const cell &c, const cellEdgeAddressing &cAddr, const scalar cVolume, const Type &cPsi, const labelListList &cCuts, const faceUList &fs, const vectorField &fAreas, const vectorField &fCentres, const vectorField &fPsis, const vectorField &fCutAreas, const vectorField &fCutPsis, const pointField &ps, const Field< Type > &pPsis, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the cell-volume and cell-volume-integral of the given property over.
auto tupleBinaryOp(const Tuple &tupleA, const Tuple &tupleB, const std::integer_sequence< Int, Is ... > &, const BinaryOp &bop)
void tupleInPlaceOp(Tuple &tuple, const std::integer_sequence< Int, Is ... > &, const Op &op)
void tupleInPlaceOp(std::tuple< Types... > &tuple, const Op &op)
Type average(const List< Type > &xs, const labelUList &is)
auto tupleOp(const Tuple &tuple, const std::integer_sequence< Int, Is ... > &, const Op &op)
auto tupleBinaryOp(const std::tuple< TypesA ... > &tupleA, const std::tuple< TypesB ... > &tupleB, const BinaryOp &bop)
Tuple2< vector, typename outerProduct< vector, Type >::type > faceCutAreaIntegral(const face &f, const vector &fArea, const Type &fPsi, const List< labelPair > &fCuts, const pointField &ps, const Field< Type > &pPsis, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the face-area and face-area-integral of the given property over.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Vector< scalar > vector
A scalar version of the templated Vector.
List< labelList > labelListList
A List of labelList.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
auto operator()(const Type &a, const Type &b) const
void operator()(Type &x) const
auto operator()(const Type &x) const
auto operator()(const Type &x) const
auto operator()(const Type &x) const
OpScaled(const ScaleType &s)
auto operator()(const Type &x) const