meshToMeshTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "fvMesh.H"
30 #include "volFields.H"
32 #include "calculatedFvPatchField.H"
33 #include "fvcGrad.H"
35 
36 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
37 
38 template<class Type>
39 void Foam::meshToMesh::add
40 (
41  UList<Type>& fld,
42  const label offset
43 ) const
44 {
45  forAll(fld, i)
46  {
47  fld[i] += offset;
48  }
49 }
50 
51 
52 template<class Type, class CombineOp>
54 (
55  const UList<Type>& srcField,
56  const CombineOp& cop,
57  List<Type>& result
58 ) const
59 {
60  if (result.size() != tgtToSrcCellAddr_.size())
61  {
63  << "Supplied field size is not equal to target mesh size" << nl
64  << " source mesh = " << srcToTgtCellAddr_.size() << nl
65  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
66  << " supplied field = " << result.size()
67  << abort(FatalError);
68  }
69 
70  multiplyWeightedOp<Type, CombineOp> cbop(cop);
71 
72  if (distributed())
73  {
74  const mapDistribute& map = srcMapPtr_();
75 
76  List<Type> work(srcField);
77  map.distribute(work);
78 
79  forAll(result, celli)
80  {
81  const labelList& srcAddress = tgtToSrcCellAddr_[celli];
82  const scalarList& srcWeight = tgtToSrcCellWght_[celli];
83 
84  if (srcAddress.size())
85  {
86 // result[celli] = Zero;
87  result[celli] *= (1.0 - sum(srcWeight));
88  forAll(srcAddress, i)
89  {
90  label srcI = srcAddress[i];
91  scalar w = srcWeight[i];
92  cbop(result[celli], celli, work[srcI], w);
93  }
94  }
95  }
96  }
97  else
98  {
99  forAll(result, celli)
100  {
101  const labelList& srcAddress = tgtToSrcCellAddr_[celli];
102  const scalarList& srcWeight = tgtToSrcCellWght_[celli];
103 
104  if (srcAddress.size())
105  {
106 // result[celli] = Zero;
107  result[celli] *= (1.0 - sum(srcWeight));
108  forAll(srcAddress, i)
109  {
110  label srcI = srcAddress[i];
111  scalar w = srcWeight[i];
112  cbop(result[celli], celli, srcField[srcI], w);
113  }
114  }
115  }
116  }
117 }
118 
119 
120 template<class Type, class CombineOp>
122 (
123  const UList<Type>& srcField,
124  const UList<typename outerProduct<vector, Type>::type>& srcGradField,
125  const CombineOp& cop,
126  List<Type>& result
127 ) const
128 {
129  if (result.size() != tgtToSrcCellAddr_.size())
130  {
132  << "Supplied field size is not equal to target mesh size" << nl
133  << " source mesh = " << srcToTgtCellAddr_.size() << nl
134  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
135  << " supplied field = " << result.size()
136  << abort(FatalError);
137  }
138 
139  multiplyWeightedOp<Type, CombineOp> cbop(cop);
140 
141  if (distributed())
142  {
143  if (returnReduceAnd(tgtToSrcCellVec_.empty()))
144  {
145  // No correction vectors calculated. Fall back to first order.
146  mapSrcToTgt(srcField, cop, result);
147  return;
148  }
149 
150  const mapDistribute& map = srcMapPtr_();
151 
152  List<Type> work(srcField);
153  map.distribute(work);
154 
156  (
157  srcGradField
158  );
159  map.distribute(workGrad);
160 
161  forAll(result, cellI)
162  {
163  const labelList& srcAddress = tgtToSrcCellAddr_[cellI];
164  const scalarList& srcWeight = tgtToSrcCellWght_[cellI];
165  const pointList& srcVec = tgtToSrcCellVec_[cellI];
166 
167  if (srcAddress.size())
168  {
169  result[cellI] *= (1.0 - sum(srcWeight));
170  forAll(srcAddress, i)
171  {
172  label srcI = srcAddress[i];
173  scalar w = srcWeight[i];
174  const vector& v = srcVec[i];
175  const Type srcVal = work[srcI]+(workGrad[srcI]&v);
176  cbop(result[cellI], cellI, srcVal, w);
177  }
178  }
179  }
180  }
181  else
182  {
183  if (tgtToSrcCellVec_.empty())
184  {
185  // No correction vectors calculated. Fall back to first order.
186  mapSrcToTgt(srcField, cop, result);
187  return;
188  }
189 
190  forAll(result, cellI)
191  {
192  const labelList& srcAddress = tgtToSrcCellAddr_[cellI];
193  const scalarList& srcWeight = tgtToSrcCellWght_[cellI];
194  const pointList& srcVec = tgtToSrcCellVec_[cellI];
195 
196  if (srcAddress.size())
197  {
198  // Do non-conservative interpolation
199  result[cellI] *= (1.0 - sum(srcWeight));
200  forAll(srcAddress, i)
201  {
202  label srcI = srcAddress[i];
203  scalar w = srcWeight[i];
204  const vector& v = srcVec[i];
205  const Type srcVal = srcField[srcI]+(srcGradField[srcI]&v);
206  cbop(result[cellI], cellI, srcVal, w);
207  }
208  }
209  }
210  }
211 }
212 
213 
214 template<class Type, class CombineOp>
216 (
217  const Field<Type>& srcField,
218  const CombineOp& cop
219 ) const
220 {
221  auto tresult = tmp<Field<Type>>::New(tgtToSrcCellAddr_.size(), Zero);
222 
223  mapSrcToTgt(srcField, cop, tresult.ref());
225  return tresult;
226 }
227 
228 
229 template<class Type, class CombineOp>
231 (
232  const tmp<Field<Type>>& tsrcField,
233  const CombineOp& cop
234 ) const
235 {
236  return mapSrcToTgt(tsrcField(), cop);
237 }
238 
239 
240 template<class Type>
242 (
243  const Field<Type>& srcField
244 ) const
245 {
246  return mapSrcToTgt(srcField, plusEqOp<Type>());
247 }
248 
249 
250 template<class Type>
252 (
253  const tmp<Field<Type>>& tsrcField
254 ) const
255 {
256  return mapSrcToTgt(tsrcField());
257 }
258 
259 
260 template<class Type, class CombineOp>
262 (
263  const UList<Type>& tgtField,
264  const CombineOp& cop,
265  List<Type>& result
266 ) const
267 {
268  if (result.size() != srcToTgtCellAddr_.size())
269  {
271  << "Supplied field size is not equal to source mesh size" << nl
272  << " source mesh = " << srcToTgtCellAddr_.size() << nl
273  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
274  << " supplied field = " << result.size()
275  << abort(FatalError);
276  }
277 
278  multiplyWeightedOp<Type, CombineOp> cbop(cop);
279 
280  if (distributed())
281  {
282  const mapDistribute& map = tgtMapPtr_();
283 
284  List<Type> work(tgtField);
285  map.distribute(work);
286 
287  forAll(result, celli)
288  {
289  const labelList& tgtAddress = srcToTgtCellAddr_[celli];
290  const scalarList& tgtWeight = srcToTgtCellWght_[celli];
291 
292  if (tgtAddress.size())
293  {
294  result[celli] *= (1.0 - sum(tgtWeight));
295  forAll(tgtAddress, i)
296  {
297  label tgtI = tgtAddress[i];
298  scalar w = tgtWeight[i];
299  cbop(result[celli], celli, work[tgtI], w);
300  }
301  }
302  }
303  }
304  else
305  {
306  forAll(result, celli)
307  {
308  const labelList& tgtAddress = srcToTgtCellAddr_[celli];
309  const scalarList& tgtWeight = srcToTgtCellWght_[celli];
310 
311  if (tgtAddress.size())
312  {
313  result[celli] *= (1.0 - sum(tgtWeight));
314  forAll(tgtAddress, i)
315  {
316  label tgtI = tgtAddress[i];
317  scalar w = tgtWeight[i];
318  cbop(result[celli], celli, tgtField[tgtI], w);
319  }
320  }
321  }
322  }
323 }
324 
325 
326 template<class Type, class CombineOp>
328 (
329  const UList<Type>& tgtField,
330  const UList<typename outerProduct<vector, Type>::type>& tgtGradField,
331  const CombineOp& cop,
332  List<Type>& result
333 ) const
334 {
335  if (result.size() != srcToTgtCellAddr_.size())
336  {
338  << "Supplied field size is not equal to source mesh size" << nl
339  << " source mesh = " << srcToTgtCellAddr_.size() << nl
340  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
341  << " supplied field = " << result.size()
342  << abort(FatalError);
343  }
344 
345  multiplyWeightedOp<Type, CombineOp> cbop(cop);
346 
347  if (distributed())
348  {
349  if (returnReduceAnd(srcToTgtCellVec_.empty()))
350  {
351  // No correction vectors calculated. Fall back to first order.
352  mapTgtToSrc(tgtField, cop, result);
353  return;
354  }
355 
356  const mapDistribute& map = tgtMapPtr_();
357 
358  List<Type> work(tgtField);
359  map.distribute(work);
360 
362  (
363  tgtGradField
364  );
365  map.distribute(workGrad);
366 
367  forAll(result, cellI)
368  {
369  const labelList& tgtAddress = srcToTgtCellAddr_[cellI];
370  const scalarList& tgtWeight = srcToTgtCellWght_[cellI];
371  const pointList& tgtVec = srcToTgtCellVec_[cellI];
372 
373  if (tgtAddress.size())
374  {
375  result[cellI] *= (1.0 - sum(tgtWeight));
376  forAll(tgtAddress, i)
377  {
378  label tgtI = tgtAddress[i];
379  scalar w = tgtWeight[i];
380  const vector& v = tgtVec[i];
381  const Type tgtVal = work[tgtI]+(workGrad[tgtI]&v);
382  cbop(result[cellI], cellI, tgtVal, w);
383  }
384  }
385  }
386  }
387  else
388  {
389  forAll(result, cellI)
390  {
391  const labelList& tgtAddress = srcToTgtCellAddr_[cellI];
392  const scalarList& tgtWeight = srcToTgtCellWght_[cellI];
393  const pointList& tgtVec = srcToTgtCellVec_[cellI];
394 
395  if (tgtAddress.size())
396  {
397  result[cellI] *= (1.0 - sum(tgtWeight));
398  forAll(tgtAddress, i)
399  {
400  label tgtI = tgtAddress[i];
401  scalar w = tgtWeight[i];
402  const vector& v = tgtVec[i];
403  const Type tgtVal = tgtField[tgtI]+(tgtGradField[tgtI]&v);
404  cbop(result[cellI], cellI, tgtVal, w);
405  }
406  }
407  }
408  }
409 }
410 
411 
412 template<class Type, class CombineOp>
414 (
415  const Field<Type>& tgtField,
416  const CombineOp& cop
417 ) const
418 {
419  auto tresult = tmp<Field<Type>>::New(srcToTgtCellAddr_.size(), Zero);
420 
421  mapTgtToSrc(tgtField, cop, tresult.ref());
423  return tresult;
424 }
425 
426 
427 template<class Type, class CombineOp>
429 (
430  const tmp<Field<Type>>& ttgtField,
431  const CombineOp& cop
432 ) const
433 {
434  return mapTgtToSrc(ttgtField(), cop);
435 }
436 
437 
438 template<class Type>
440 (
441  const Field<Type>& tgtField
442 ) const
443 {
444  return mapTgtToSrc(tgtField, plusEqOp<Type>());
445 }
446 
447 
448 template<class Type>
450 (
451  const tmp<Field<Type>>& ttgtField
452 ) const
453 {
454  return mapTgtToSrc(ttgtField(), plusEqOp<Type>());
455 }
456 
457 
458 template<class Type, class CombineOp>
459 void Foam::meshToMesh::mapInternalSrcToTgt
460 (
461  const VolumeField<Type>& field,
462  const CombineOp& cop,
463  VolumeField<Type>& result,
464  const bool secondOrder
465 ) const
466 {
467  if (secondOrder && returnReduceOr(tgtToSrcCellVec_.size()))
468  {
469  mapSrcToTgt
470  (
471  field,
472  fvc::grad(field)().primitiveField(),
473  cop,
474  result.primitiveFieldRef()
475  );
476  }
477  else
478  {
479  mapSrcToTgt(field, cop, result.primitiveFieldRef());
480  }
481 }
482 
483 
484 template<class Type, class CombineOp>
485 void Foam::meshToMesh::mapAndOpSrcToTgt
486 (
487  const AMIPatchToPatchInterpolation& AMI,
488  const Field<Type>& srcField,
489  Field<Type>& tgtField,
490  const CombineOp& cop
491 ) const
492 {
493  tgtField = Type(Zero);
494 
495  AMI.interpolateToTarget
496  (
497  srcField,
498  multiplyWeightedOp<Type, CombineOp>(cop),
499  tgtField,
501  );
502 }
503 
504 
505 template<class Type, class CombineOp>
507 (
508  const VolumeField<Type>& field,
509  const CombineOp& cop,
510  VolumeField<Type>& result,
511  const bool secondOrder
512 ) const
513 {
514  mapInternalSrcToTgt(field, cop, result, secondOrder);
515 
516  const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
517 
518  auto& resultBf = result.boundaryFieldRef();
519 
520  forAll(AMIList, i)
521  {
522  label srcPatchi = srcPatchID_[i];
523  label tgtPatchi = tgtPatchID_[i];
524 
525  const fvPatchField<Type>& srcField = field.boundaryField()[srcPatchi];
526  fvPatchField<Type>& tgtField = resultBf[tgtPatchi];
527 
528  // Clone and map (since rmap does not do general mapping)
529  tmp<fvPatchField<Type>> tnewTgt
530  (
532  (
533  srcField,
534  tgtField.patch(),
535  result(),
537  (
538  AMIList[i].singlePatchProc(),
539  (
540  AMIList[i].distributed()
541  ? AMIList[i].hasSrcMap() // pointer to map
542  : nullptr
543  ),
544  AMIList[i].tgtAddress(),
545  AMIList[i].tgtWeights()
546  )
547  )
548  );
549 
550  // Transfer all mapped quantities (value and e.g. gradient) onto
551  // tgtField. Value will get overwritten below.
552  tgtField.rmap(tnewTgt(), identity(tgtField.size()));
553 
554  // Override value to account for CombineOp (note: is dummy template
555  // specialisation for plusEqOp)
556  mapAndOpSrcToTgt(AMIList[i], srcField, tgtField, cop);
557  }
558 
559  forAll(cuttingPatches_, i)
560  {
561  label patchi = cuttingPatches_[i];
562  fvPatchField<Type>& pf = resultBf[patchi];
563  pf == pf.patchInternalField();
564  }
565 }
566 
567 
568 template<class Type, class CombineOp>
571 (
572  const VolumeField<Type>& field,
573  const CombineOp& cop,
574  const bool secondOrder
575 ) const
576 {
577  const fvMesh& tgtMesh = static_cast<const fvMesh&>(tgtRegion_);
578 
579  const fvBoundaryMesh& tgtBm = tgtMesh.boundary();
580  const auto& srcBfld = field.boundaryField();
581 
582  PtrList<fvPatchField<Type>> tgtPatchFields(tgtBm.size());
583 
584  // construct tgt boundary patch types as copy of 'field' boundary types
585  // note: this will provide place holders for fields with additional
586  // entries, but these values will need to be reset
587  forAll(tgtPatchID_, i)
588  {
589  label srcPatchi = srcPatchID_[i];
590  label tgtPatchi = tgtPatchID_[i];
591 
592  if (!tgtPatchFields.set(tgtPatchi))
593  {
594  tgtPatchFields.set
595  (
596  tgtPatchi,
598  (
599  srcBfld[srcPatchi],
600  tgtMesh.boundary()[tgtPatchi],
603  (
604  labelList(tgtMesh.boundary()[tgtPatchi].size(), -1)
605  )
606  )
607  );
608  }
609  }
610 
611  // Any unset tgtPatchFields become calculated
612  forAll(tgtPatchFields, tgtPatchi)
613  {
614  if (!tgtPatchFields.set(tgtPatchi))
615  {
616  // Note: use factory New method instead of direct generation of
617  // calculated so we keep constraints
618  tgtPatchFields.set
619  (
620  tgtPatchi,
622  (
624  tgtMesh.boundary()[tgtPatchi],
626  )
627  );
628  }
629  }
630 
631  auto tresult =
632  tmp<VolumeField<Type>>::New
633  (
634  tgtMesh.newIOobject
635  (
637  (
638  type(),
639  "interpolate(" + field.name() + ")"
640  )
641  ),
642  tgtMesh,
643  field.dimensions(),
644  Field<Type>(tgtMesh.nCells(), Zero),
645  tgtPatchFields
646  );
647 
648  mapSrcToTgt(field, cop, tresult.ref(), secondOrder);
649 
650  return tresult;
651 }
652 
653 
654 template<class Type, class CombineOp>
657 (
658  const tmp<VolumeField<Type>>& tfield,
659  const CombineOp& cop,
660  const bool secondOrder
661 ) const
662 {
663  return mapSrcToTgt(tfield(), cop, secondOrder);
664 }
665 
666 
667 template<class Type>
670 (
671  const VolumeField<Type>& field,
672  const bool secondOrder
673 ) const
674 {
675  return mapSrcToTgt(field, plusEqOp<Type>(), secondOrder);
676 }
677 
678 
679 template<class Type>
682 (
683  const tmp<VolumeField<Type>>& tfield,
684  const bool secondOrder
685 ) const
686 {
687  return mapSrcToTgt(tfield(), plusEqOp<Type>(), secondOrder);
688 }
689 
690 
691 template<class Type, class CombineOp>
692 void Foam::meshToMesh::mapInternalTgtToSrc
693 (
694  const VolumeField<Type>& field,
695  const CombineOp& cop,
696  VolumeField<Type>& result,
697  const bool secondOrder
698 ) const
699 {
700  if (secondOrder && returnReduceOr(srcToTgtCellVec_.size()))
701  {
702  mapTgtToSrc
703  (
704  field,
705  fvc::grad(field)().primitiveField(),
706  cop,
707  result.primitiveFieldRef()
708  );
709  }
710  else
711  {
712  mapTgtToSrc(field, cop, result.primitiveFieldRef());
713  }
714 }
715 
716 
717 template<class Type, class CombineOp>
718 void Foam::meshToMesh::mapAndOpTgtToSrc
719 (
720  const AMIPatchToPatchInterpolation& AMI,
721  Field<Type>& srcField,
722  const Field<Type>& tgtField,
723  const CombineOp& cop
724 ) const
725 {
726  srcField = Type(Zero);
727 
728  AMI.interpolateToSource
729  (
730  tgtField,
731  multiplyWeightedOp<Type, CombineOp>(cop),
732  srcField,
734  );
735 }
736 
737 
738 template<class Type, class CombineOp>
740 (
741  const VolumeField<Type>& field,
742  const CombineOp& cop,
743  VolumeField<Type>& result,
744  const bool secondOrder
745 ) const
746 {
747  mapInternalTgtToSrc(field, cop, result, secondOrder);
748 
749  const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
750 
751  forAll(AMIList, i)
752  {
753  label srcPatchi = srcPatchID_[i];
754  label tgtPatchi = tgtPatchID_[i];
755 
756  fvPatchField<Type>& srcField = result.boundaryFieldRef()[srcPatchi];
757  const fvPatchField<Type>& tgtField = field.boundaryField()[tgtPatchi];
758 
759 
760  // Clone and map (since rmap does not do general mapping)
761  tmp<fvPatchField<Type>> tnewSrc
762  (
764  (
765  tgtField,
766  srcField.patch(),
767  result(),
769  (
770  AMIList[i].singlePatchProc(),
771  (
772  AMIList[i].distributed()
773  ? AMIList[i].hasTgtMap() // pointer to map
774  : nullptr
775  ),
776  AMIList[i].srcAddress(),
777  AMIList[i].srcWeights()
778  )
779  )
780  );
781  // Transfer all mapped quantities (value and e.g. gradient) onto
782  // srcField. Value will get overwritten below
783  srcField.rmap(tnewSrc(), identity(srcField.size()));
784 
785  // Override value to account for CombineOp (could be dummy for
786  // plusEqOp)
787  mapAndOpTgtToSrc(AMIList[i], srcField, tgtField, cop);
788  }
789 
790  forAll(cuttingPatches_, i)
791  {
792  label patchi = cuttingPatches_[i];
793  fvPatchField<Type>& pf = result.boundaryFieldRef()[patchi];
794  pf == pf.patchInternalField();
795  }
796 }
797 
798 
799 template<class Type, class CombineOp>
802 (
803  const VolumeField<Type>& field,
804  const CombineOp& cop,
805  const bool secondOrder
806 ) const
807 {
808  const fvMesh& srcMesh = static_cast<const fvMesh&>(srcRegion_);
809 
810  const fvBoundaryMesh& srcBm = srcMesh.boundary();
811  const auto& tgtBfld = field.boundaryField();
812 
813  PtrList<fvPatchField<Type>> srcPatchFields(srcBm.size());
814 
815  // construct src boundary patch types as copy of 'field' boundary types
816  // note: this will provide place holders for fields with additional
817  // entries, but these values will need to be reset
818  forAll(srcPatchID_, i)
819  {
820  label srcPatchi = srcPatchID_[i];
821  label tgtPatchi = tgtPatchID_[i];
822 
823  if (!srcPatchFields.set(srcPatchi))
824  {
825  srcPatchFields.set
826  (
827  srcPatchi,
829  (
830  tgtBfld[tgtPatchi],
831  srcMesh.boundary()[srcPatchi],
834  (
835  labelList(srcMesh.boundary()[srcPatchi].size(), -1)
836  )
837  )
838  );
839  }
840  }
841 
842  // Any unset srcPatchFields become calculated
843  forAll(srcPatchFields, srcPatchi)
844  {
845  if (!srcPatchFields.set(srcPatchi))
846  {
847  // Note: use factory New method instead of direct generation of
848  // calculated so we keep constraints
849  srcPatchFields.set
850  (
851  srcPatchi,
853  (
855  srcMesh.boundary()[srcPatchi],
857  )
858  );
859  }
860  }
861 
862  auto tresult =
863  tmp<VolumeField<Type>>::New
864  (
865  srcMesh.newIOobject
866  (
868  (
869  type(),
870  "interpolate(" + field.name() + ")"
871  )
872  ),
873  srcMesh,
874  field.dimensions(),
875  Field<Type>(srcMesh.nCells(), Zero),
876  srcPatchFields
877  );
878 
879  mapTgtToSrc(field, cop, tresult.ref(), secondOrder);
880 
881  return tresult;
882 }
883 
884 
885 template<class Type, class CombineOp>
888 (
889  const tmp<VolumeField<Type>>& tfield,
890  const CombineOp& cop,
891  const bool secondOrder
892 ) const
893 {
894  return mapTgtToSrc(tfield(), cop, secondOrder);
895 }
896 
897 
898 template<class Type>
901 (
902  const VolumeField<Type>& field,
903  const bool secondOrder
904 ) const
905 {
906  return mapTgtToSrc(field, plusEqOp<Type>(), secondOrder);
907 }
908 
909 
910 template<class Type>
913 (
914  const tmp<VolumeField<Type>>& tfield,
915  const bool secondOrder
916 ) const
917 {
918  return mapTgtToSrc(tfield(), plusEqOp<Type>(), secondOrder);
919 }
920 
921 
922 // ************************************************************************* //
List< scalar > scalarList
List of scalar.
Definition: scalarList.H:32
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:47
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
type
Types of root.
Definition: Roots.H:52
rDeltaTY field()
FieldMapper with weighted mapping from (optionally remote) quantities.
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
const fvPatch & patch() const noexcept
Return the patch.
Definition: fvPatchField.H:269
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:608
static const DimensionedField< Type, GeoMesh > & null() noexcept
Return a null DimensionedField (reference to a nullObject).
AMIInterpolation AMIPatchToPatchInterpolation
Patch-to-patch interpolation == Foam::AMIInterpolation.
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:118
Generic GeometricField class.
DirectFieldMapper< fvPatchFieldMapper > directFvPatchFieldMapper
A fvPatchFieldMapper with direct mapping.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Definition: IOobjectI.H:40
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
Definition: labelLists.C:44
Generic templated field type.
Definition: Field.H:62
Calculate the gradient of the given field.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: fvPatchField.C:299
Vector< scalar > vector
Definition: vector.H:57
errorManip< error > abort(error &err)
Definition: errorManip.H:139
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
static const word & calculatedType() noexcept
The type name for calculated patch fields.
Definition: fvPatchField.H:204
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
List< point > pointList
List of point.
Definition: pointList.H:32
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
void mapSrcToTgt(const UList< Type > &srcFld, const CombineOp &cop, List< Type > &result) const
Map field from src to tgt mesh with defined operation.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
static tmp< fvPatchField< Type > > New(const word &patchFieldType, const fvPatch &, const DimensionedField< Type, volMesh > &)
Return a pointer to a new patchField created on freestore given.
void mapTgtToSrc(const UList< Type > &tgtFld, const CombineOp &cop, List< Type > &result) const
Map field from tgt to src mesh with defined operation.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127