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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Copyright (C) 2011-2026 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Class
    Foam::GeometricField

Description
    Generic GeometricField class.

SourceFiles
    GeometricFieldI.H
    GeometricField.C
    GeometricFieldExpression.H

\*---------------------------------------------------------------------------*/

#ifndef GeometricField_H
#define GeometricField_H

#include "GeometricFieldFwd.H"
#include "GeometricBoundaryField.H"
#include "GeometricFieldSources.H"
#include "expressionExpressionable.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

class dictionary;

/*---------------------------------------------------------------------------*\
                       Class GeometricField Declaration
\*---------------------------------------------------------------------------*/

template<class Type, class GeoMesh, template<class> class PrimitiveField>
class GeometricField
:
    public DimensionedField<Type, GeoMesh, PrimitiveField>,
    public OldTimeField<GeometricField<Type, GeoMesh, PrimitiveField>>
{

public:

    // Public Types

        //- Value type
        using Type_ = Type;

        //- Geometric mesh type
        using GeoMesh_ = GeoMesh;

        //- Base mesh type from which GeoMesh is constructed
        using Mesh = typename GeoMesh::Mesh;

        //- Type of the internal field from which this GeometricField is derived
        using Internal = DimensionedField<Type, GeoMesh, PrimitiveField>;

        //- Type of the field from which this GeometricField is derived
        using Base = DimensionedField<Type, GeoMesh, PrimitiveField>;

        //- Type of the patch field of which the Boundary is composed
        using PatchField = typename GeoMesh::template PatchField<Type>;

        //- Type of the boundary field
        using BoundaryField = PtrField<PatchField>;

        //- Type of the boundary field
        using Boundary = GeometricBoundaryField<Type, GeoMesh, PrimitiveField>;

        //- Type of the field source of which the Sources is composed
        using Source = typename GeoMesh::template FieldSource<Type>;

        //- Type of the field sources
        using Sources = GeometricFieldSources<Type, GeoMesh, PrimitiveField>;

        //- Component type of the elements of the field
        using cmptType = typename PrimitiveField<Type>::cmptType;


private:

    // Private Data

        //-  Pointer to previous iteration (used for under-relaxation)
        mutable GeometricField<Type, GeoMesh, Field>* fieldPrevIterPtr_;

        //- Boundary Type field containing boundary field values
        Boundary boundaryField_;

        //- Type field sources containing field source values
        Sources sources_;


    // Private Member Functions

        //- Read the field from the dictionary
        void readFields(const dictionary&);

        //- Read the field - create the field dictionary on-the-fly
        void readFields();

        //- Read from file if it is present
        bool readIfPresent();

        //- Constructor given IOobject, mesh, dimensions and patch field types.
        //  This allocates storage for the field but not values
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dimensionSet&,
            const wordList& wantedPatchTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );


public:

    //- Runtime type information
    TypeName("GeometricField");


    //- Declare friendship with other geometric fields
    template<class Type2, class GeoMesh2, template<class> class PrimitiveField2>
    friend class GeometricField;


    // Static Member Functions

        //- Return a null geometric field
        inline static const
            GeometricField<Type, GeoMesh, PrimitiveField>& null();


    // Constructors

        //- Constructor given IOobject, mesh, dimensions and patch field type.
        //  Warning: this allocates storage but does not set field values!
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dimensionSet&,
            const word& patchFieldType
        );

        //- Constructor given IOobject, mesh, dimensioned<Type>
        //  and optional patch field type.
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dimensioned<Type>&,
            const word& patchFieldType = PatchField::calculatedType()
        );

        //- Constructor given IOobject, mesh, dimensioned<Type>
        //  and patch field types.
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dimensioned<Type>&,
            const wordList& wantedPatchTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Constructor from components
        GeometricField
        (
            const IOobject&,
            const Internal&,
            const PtrField<PatchField>&,
            const HashPtrTable<Source>& = HashPtrTable<Source>()
        );

        //- Constructor from component expressions
        template
        <
            class InternalExpression,
            class BoundaryExpression,
            class = EnableIfExpressionable<InternalExpression>
        >
        GeometricField
        (
            const IOobject&,
            const InternalExpression&,
            const BoundaryExpression&,
            const HashPtrTable<Source>& = HashPtrTable<Source>()
        );

        //- Constructor from components
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dimensionSet&,
            const PrimitiveField<Type>&,
            const PtrField<PatchField>&,
            const HashPtrTable<Source>& = HashPtrTable<Source>()
        );

        //- Constructor from component expressions
        template
        <
            class InternalExpression,
            class BoundaryExpression,
            class = EnableIfExpressionable<InternalExpression>
        >
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dimensionSet&,
            const InternalExpression&,
            const BoundaryExpression&,
            const HashPtrTable<Source>& = HashPtrTable<Source>()
        );

        //- Construct and read given IOobject
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dimensionSet& dims = dimensions::invalid
        );

        //- Construct from dictionary
        GeometricField
        (
            const IOobject&,
            const GeoMesh&,
            const dictionary&,
            const dimensionSet& dims = dimensions::invalid
        );

        //- Copy constructor
        GeometricField(const GeometricField<Type, GeoMesh, PrimitiveField>&);

        //- Copy constructor
        template<template<class> class PrimitiveField2>
        explicit GeometricField
        (
            const GeometricField<Type, GeoMesh, PrimitiveField2>&
        );

        //- Move constructor
        GeometricField(GeometricField<Type, GeoMesh, PrimitiveField>&&);

        //- Construct as copy of tmp
        GeometricField
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&
        );

        //- Construct from an expression
        template<class Expression, class = EnableIfExpressionable<Expression>>
        GeometricField(const Expression& e);

        //- Construct as copy resetting IO parameters
        template<template<class> class PrimitiveField2>
        GeometricField
        (
            const IOobject&,
            const GeometricField<Type, GeoMesh, PrimitiveField2>&
        );

        //- Construct as copy of tmp resetting IO parameters
        GeometricField
        (
            const IOobject&,
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&
        );

        //- Construct as copy resetting name
        template<template<class> class PrimitiveField2>
        GeometricField
        (
            const word& newName,
            const GeometricField<Type, GeoMesh, PrimitiveField2>&
        );

        //- Construct as copy of tmp resetting name
        GeometricField
        (
            const word& newName,
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&
        );

        //- Construct as copy resetting IO parameters and patch field type
        template<template<class> class PrimitiveField2>
        GeometricField
        (
            const IOobject&,
            const GeometricField<Type, GeoMesh, PrimitiveField2>&,
            const word& patchFieldType
        );

        //- Construct as copy of tmp resetting IO parameters
        //  and patch field type
        GeometricField
        (
            const IOobject&,
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&,
            const word& patchFieldType
        );

        //- Construct as copy of expression setting IO parameters
        //  and patch field type
        template<class Expression, class = EnableIfExpressionable<Expression>>
        GeometricField
        (
            const IOobject&,
            const Expression& e,
            const word& patchFieldType
        );

        //- Constructor from internal field and patch field type
        template<template<class> class PrimitiveField2>
        GeometricField
        (
            const IOobject&,
            const DimensionedField<Type, GeoMesh, PrimitiveField2>&,
            const word& patchFieldType
        );

        //- Constructor from temporary internal field and patch field type
        GeometricField
        (
            const IOobject&,
            const tmp<Internal>&,
            const word& patchFieldType
        );

        //- Construct as copy resetting IO parameters and patch field types
        template<template<class> class PrimitiveField2>
        GeometricField
        (
            const IOobject&,
            const GeometricField<Type, GeoMesh, PrimitiveField2>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Construct as copy of tmp resetting IO parameters
        //  and patch field types
        GeometricField
        (
            const IOobject&,
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Construct as copy of tmp resetting IO parameters
        //  and patch field types
        template <class Expression, class = EnableIfExpressionable<Expression>>
        GeometricField
        (
            const IOobject&,
            const Expression&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Construct from IOobject, internal field and patch field types
        template<template<class> class PrimitiveField2>
        GeometricField
        (
            const IOobject&,
            const DimensionedField<Type, GeoMesh, PrimitiveField2>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Construct from IOobject, tmp internal field and patch field types
        GeometricField
        (
            const IOobject&,
            const tmp<Internal>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Clone
        tmp<GeometricField<Type, GeoMesh, PrimitiveField>> clone() const;

        //- Clone un-sliced
        tmp<GeometricField<Type, GeoMesh, PrimitiveField>>
            cloneUnSliced() const;

        //- Return a temporary field constructed from name,
        //  internal field and list of patch fields
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const Internal&,
            const PtrField<PatchField>&,
            const HashPtrTable<Source>& = HashPtrTable<Source>()
        );

        //- Return a temporary field constructed from name,
        //  internal field and list of patch fields
        template
        <
            class InternalExpression,
            class BoundaryExpression,
            class = EnableIfExpressionable<InternalExpression>
        >
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const InternalExpression&,
            const BoundaryExpression&,
            const HashPtrTable<Source>& = HashPtrTable<Source>()
        );

        //- Return a temporary field constructed from name, mesh, dimensionSet
        //  and patch field type
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const GeoMesh&,
            const dimensionSet&,
            const word& patchFieldType = PatchField::calculatedType()
        );

        //- Return a temporary field constructed from mesh, dimensioned<Type>
        //  and patch field type
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const GeoMesh&,
            const dimensioned<Type>&,
            const word& patchFieldType = PatchField::calculatedType()
        );

        //- Return a temporary field constructed from mesh, dimensioned<Type>
        //  and patch field types
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const GeoMesh&,
            const dimensioned<Type>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Rename temporary field and return
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& newName,
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&
        );

        //- Rename field, reset patch field type and return
        template<template<class> class PrimitiveField2>
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& newName,
            const GeometricField<Type, GeoMesh, PrimitiveField2>&,
            const word& patchFieldType
        );

        //- Rename temporary field, reset patch field type and return
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& newName,
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&,
            const word& patchFieldType
        );

        //- Return a temporary field constructed from name,
        //  internal field and patch field type
        template<template<class> class PrimitiveField2>
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const DimensionedField<Type, GeoMesh, PrimitiveField2>&,
            const word& patchFieldType
        );

        //- Return a temporary field constructed from name,
        //  temporary internal field and patch field type
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const tmp<Internal>&,
            const word& patchFieldType
        );

        //- Return a temporary field constructed from name,
        //  internal field expression and patch field type
        template<class Expression, class = EnableIfExpression<Expression>>
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& name,
            const Expression& e,
            const word& patchFieldType
        );

        //- Rename and reset patch fields types of field and return
        template<template<class> class PrimitiveField2>
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& newName,
            const GeometricField<Type, GeoMesh, PrimitiveField2>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Rename and reset patch fields types of temporary field and return
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& newName,
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Return a temporary field constructed from IOobject,
        //  internal field and patch field types
        template<template<class> class PrimitiveField2>
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& newName,
            const DimensionedField<Type, GeoMesh, PrimitiveField2>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );

        //- Return a temporary field constructed from IOobject,
        //  temporary internal field and patch field types
        static tmp<GeometricField<Type, GeoMesh, PrimitiveField>> New
        (
            const word& newName,
            const tmp<Internal>&,
            const wordList& patchFieldTypes,
            const wordList& actualPatchTypes = wordList(),
            const HashTable<word>& fieldSourceTypes = HashTable<word>(),
            const IOerrorLocation& fieldSourceErrorLocation = IOerrorLocation()
        );


    //- Destructor
    virtual ~GeometricField();


    // Member Functions

        //- Return a reference to the dimensioned internal field
        //  Note: this increments the event counter and checks the
        //  old-time fields; avoid in loops.
        Internal& internalFieldRef();

        //- Return a const-reference to the dimensioned internal field
        inline const Internal& internalField() const;

        //- Return a reference to the primitive field
        //  Note: this increments the event counter and checks the
        //  old-time fields; avoid in loops.
        typename Internal::FieldType& primitiveFieldRef();

        //- Return a const-reference to the primitive field
        inline const typename Internal::FieldType& primitiveField() const;

        //- Return a reference to the boundary field
        //  Note: this increments the event counter and checks the
        //  old-time fields; avoid in loops.
        Boundary& boundaryRef();

        //- Return a reference to the boundary field without storing old times
        //  Note: this increments the event counter; avoid in loops.
        Boundary& boundaryRefNoStoreOldTimes();

        //- Return const-reference to the boundary field
        inline const Boundary& boundary() const;

        //- Return a reference to the boundary field
        //  Note: this increments the event counter and checks the
        //  old-time fields; avoid in loops.
        BoundaryField& boundaryFieldRef();

        //- Return a reference to the boundary field without storing old times
        //  Note: this increments the event counter; avoid in loops.
        BoundaryField& boundaryFieldRefNoStoreOldTimes();

        //- Return const-reference to the boundary field
        inline const BoundaryField& boundaryField() const;

        //- Return a reference to the sources
        //  Note: this increments the event counter and checks the
        //  old-time fields; avoid in loops.
        Sources& sourcesRef();

        //- Return const-reference to the sources
        inline const Sources& sources() const;

        //- Store the field as the previous iteration value
        void storePrevIter() const;

        //- Delete the previous iteration field
        void clearPrevIter();

        //- Return previous iteration field
        const GeometricField<Type, GeoMesh, Field>& prevIter() const;

        //- Use old-time methods from the base class
        USING_OLD_TIME_FIELD(GeometricField);

        //- Correct boundary field
        void correctBoundaryConditions();

        //- Reset the field contents to the given field
        //  Used for mesh to mesh mapping
        template<template<class> class PrimitiveField2>
        void reset(const GeometricField<Type, GeoMesh, PrimitiveField2>&);

        //- Reset the field contents to the given tmp-field
        //  Used for mesh to mesh mapping
        void reset(const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&);

        //- Reset the field contents to the given tmp-field
        //  Used for mesh to mesh mapping
        template<template<class> class PrimitiveField2>
        void reset(const tmp<GeometricField<Type, GeoMesh, PrimitiveField2>>&);

        //- Does the field need a reference level for solution
        bool needReference() const;

        //- Return a component field expression of the field
        inline auto component(const direction&) const;

        //- WriteData member function required by regIOobject
        bool writeData(Ostream&) const;

        //- Return transpose field expression
        //  (only if it is a tensor field)
        inline auto T() const;

        //- Relax field (for steady-state solution).
        //  alpha >= 1 : no relaxation
        //  alpha < 1  : relaxation
        void relax(const scalar alpha);

        //- Return the field relaxation factor read from fvSolution
        //  or 1 if not specified
        scalar relaxationFactor() const;

        //- Relax current field with respect to the cached previous iteration.
        //  Relaxation factor is read from fvSolution
        void relax();

        //- Relax given field with respect to the current field
        //  and reset the field to the result
        template<template<class> class PrimitiveField2>
        void relax
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField2>>&,
            const scalar alpha
        );

        //- Relax given field with respect to the current field
        //  and reset the field to the result
        //  Relaxation factor is read from fvSolution
        template<template<class> class PrimitiveField2>
        void relax(const tmp<GeometricField<Type, GeoMesh, PrimitiveField2>>&);

        //- Select the final iteration parameters if `final' is true
        //  by returning the field name + "Final"
        //  otherwise the standard parameters by returning the field name
        word select(bool final) const;

        //- Helper function to write the min and max to an Ostream
        void writeMinMax(Ostream& os) const;


    // Member function *this operators

        void negate();

        //- Replace a component field of the field
        template<template<class> class PrimitiveField2>
        void replace
        (
            const direction,
            const GeometricField<cmptType, GeoMesh, PrimitiveField2>&
        );

        //- Replace a component field of the field
        template<template<class> class PrimitiveField2>
        void replace
        (
            const direction,
            const tmp<GeometricField<cmptType, GeoMesh, PrimitiveField2>>&
        );

        //- Replace a component field of the field from the given expression
        template<class Expression, class = EnableIfExpression<Expression>>
        void replace(const direction, const Expression&);

        //- Replace a component field of the field
        void replace(const direction, const dimensioned<cmptType>&);

        //- Bound the field to the given lower bound
        void boundLower(const dimensioned<Type>& lower);

        //- Bound the field to the given upper bound
        void boundUpper(const dimensioned<Type>& upper);

        //- Bound the field within the given lower and upper bounds
        void bound
        (
            const dimensioned<Type>& lower,
            const dimensioned<Type>& upper
        );


    // Member Operators

        //- Return a const-reference to the dimensioned internal field
        //  Useful in the formulation of source-terms for FV equations
        inline const Internal& operator()() const;

        void operator=(const GeometricField<Type, GeoMesh, PrimitiveField>&);

        void operator=(GeometricField<Type, GeoMesh, PrimitiveField>&&);

        template<template<class> class PrimitiveField2>
        void operator=(const GeometricField<Type, GeoMesh, PrimitiveField2>&);

        void operator=
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&
        );

        //- Assign to an expression
        template<class Expression, class = EnableIfExpressionable<Expression>>
        void operator=(const Expression& e);

        template<template<class> class PrimitiveField2>
        void operator=
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField2>>&
        );

        void operator=(const dimensioned<Type>&);

        void operator=(const zero&);

        template<template<class> class PrimitiveField2>
        void operator==(const GeometricField<Type, GeoMesh, PrimitiveField2>&);

        void operator==
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>&
        );

        template<template<class> class PrimitiveField2>
        void operator==
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField2>>&
        );

        //- Assign to an expression
        template<class Expression, class = EnableIfExpressionable<Expression>>
        void operator==(const Expression& e);

        void operator==(const dimensioned<Type>&);

        void operator==(const zero&);

        template<template<class> class PrimitiveField2>
        void operator+=
        (
            const GeometricField<Type, GeoMesh, PrimitiveField2>&
        );

        template<template<class> class PrimitiveField2>
        void operator+=
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField2>>&
        );

        //- Assign-add to an expression
        template<class Expression, class = EnableIfExpressionable<Expression>>
        void operator+=(const Expression& e);

        void operator+=(const dimensioned<Type>&);

        template<template<class> class PrimitiveField2>
        void operator-=
        (
            const GeometricField<Type, GeoMesh, PrimitiveField2>&
        );

        template<template<class> class PrimitiveField2>
        void operator-=
        (
            const tmp<GeometricField<Type, GeoMesh, PrimitiveField2>>&
        );

        //- Assign-subtract to an expression
        template<class Expression, class = EnableIfExpressionable<Expression>>
        void operator-=(const Expression& e);

        void operator-=(const dimensioned<Type>&);

        template<template<class> class PrimitiveField2>
        void operator*=
        (
            const GeometricField<scalar, GeoMesh, PrimitiveField2>&
        );

        template<template<class> class PrimitiveField2>
        void operator*=
        (
            const tmp<GeometricField<scalar, GeoMesh, PrimitiveField2>>&
        );

        //- Assign-multiply to an expression
        template<class Expression, class = EnableIfExpressionable<Expression>>
        void operator*=(const Expression& e);

        void operator*=(const dimensioned<scalar>&);

        template<template<class> class PrimitiveField2>
        void operator/=
        (
            const GeometricField<scalar, GeoMesh, PrimitiveField2>&
        );

        template<template<class> class PrimitiveField2>
        void operator/=
        (
            const tmp<GeometricField<scalar, GeoMesh, PrimitiveField2>>&
        );

        //- Assign-divide to an expression
        template<class Expression, class = EnableIfExpressionable<Expression>>
        void operator/=(const Expression& e);

        void operator/=(const dimensioned<scalar>&);
};


template<class Type, class GeoMesh, template<class> class PrimitiveField>
Ostream& operator<<
(
    Ostream&,
    const GeometricField<Type, GeoMesh, PrimitiveField>&
);


template<class Type, class GeoMesh, template<class> class PrimitiveField>
bool reusable(const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>& tgf);


template<class TypeR, class GeoMesh>
tmp<GeometricField<TypeR, GeoMesh, Field>> New
(
    const tmp<GeometricField<TypeR, GeoMesh, Field>>& tgf1,
    const word& name,
    const dimensionSet& dimensions,
    const bool initRet = false
);


template<class Type, class GeoMesh, template<class> class PrimitiveField>
struct OldTimeFieldCopy<GeometricField<Type, GeoMesh, PrimitiveField>>
{
    using FieldType = GeometricField<Type, GeoMesh, PrimitiveField>;

    using Field0Type = typename OldTimeField0Type<FieldType>::type;

    using Calculated = typename FieldType::PatchField::Calculated;

    tmp<Field0Type> operator()(const IOobject& io, const FieldType& field)
    {
        return tmp<Field0Type>(new Field0Type(io, field, Calculated::typeName));
    }
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "GeometricFieldI.H"
#include "GeometricFieldExpression.H"

#ifdef NoRepository
    #include "GeometricField.C"
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //