From 8ed0a59a1082bda7c3e89f108f9bc7244096d362 Mon Sep 17 00:00:00 2001 From: Ivor Clifford Date: Thu, 14 Oct 2010 17:24:41 -0400 Subject: [PATCH] Added library VectorN, containing specializations for Lists, fields, CoeffFields, blockLduMatrices, etc. for arbitrary length vectors (VectorN) and tensors (TensorN). --- src/VectorN/Make/files | 39 + src/VectorN/Make/options | 6 + .../blockVectorNLduInterfaceFields.C | 55 + .../BlockLduMatrices/blockVectorNMatrices.C | 53 + .../BlockLduMatrices/blockVectorNMatrices.H | 62 ++ .../BlockLduMatrices/blockVectorNSolvers.C | 135 +++ .../dimensionedVectorTensorN.C | 83 ++ .../dimensionedVectorTensorN.H | 114 ++ .../dimensionedVectorTensorNI.H | 65 ++ .../DimensionedDiagTensorNFields.C | 93 ++ .../DimensionedDiagTensorNFields.H | 115 ++ .../DimensionedSphericalTensorNFields.C | 75 ++ .../DimensionedSphericalTensorNFields.H | 97 ++ .../DimensionedTensorNFields.C | 100 ++ .../DimensionedTensorNFields.H | 122 +++ .../DimensionedVectorNFields.C | 69 ++ .../DimensionedVectorNFields.H | 91 ++ .../FieldFields/DiagTensorNFieldFields.C | 93 ++ .../FieldFields/DiagTensorNFieldFields.H | 114 ++ .../FieldFields/SphericalTensorNFieldFields.C | 75 ++ .../FieldFields/SphericalTensorNFieldFields.H | 95 ++ .../OpenFOAM/FieldFields/TensorNFieldFields.C | 100 ++ .../OpenFOAM/FieldFields/TensorNFieldFields.H | 121 +++ .../OpenFOAM/FieldFields/VectorNFieldFields.C | 69 ++ .../OpenFOAM/FieldFields/VectorNFieldFields.H | 90 ++ .../FieldFields/VectorTensorNFieldFieldsFwd.H | 68 ++ .../OpenFOAM/Fields/DiagTensorNFields.C | 104 ++ .../OpenFOAM/Fields/DiagTensorNFields.H | 105 ++ .../OpenFOAM/Fields/SphericalTensorNFields.C | 71 ++ .../OpenFOAM/Fields/SphericalTensorNFields.H | 87 ++ src/VectorN/OpenFOAM/Fields/TensorNFields.C | 137 +++ src/VectorN/OpenFOAM/Fields/TensorNFields.H | 125 +++ .../OpenFOAM/Fields/VectorNFieldTypes.H | 83 ++ src/VectorN/OpenFOAM/Fields/VectorNFields.C | 69 ++ src/VectorN/OpenFOAM/Fields/VectorNFields.H | 84 ++ .../OpenFOAM/Fields/VectorTensorNFields.H | 47 + .../OpenFOAM/Fields/VectorTensorNFieldsFwd.H | 65 ++ .../GeometricDiagTensorNFields.C | 97 ++ .../GeometricDiagTensorNFields.H | 118 +++ .../GeometricSphericalTensorNFields.C | 76 ++ .../GeometricSphericalTensorNFields.H | 98 ++ .../GeometricFields/GeometricTensorNFields.C | 104 ++ .../GeometricFields/GeometricTensorNFields.H | 124 +++ .../GeometricFields/GeometricVectorNFields.C | 72 ++ .../GeometricFields/GeometricVectorNFields.H | 94 ++ src/VectorN/OpenFOAM/Lists/VectorNLists.C | 53 + src/VectorN/OpenFOAM/Lists/VectorNLists.H | 60 ++ .../OpenFOAM/expandContract/ExpandTensorN.H | 95 ++ .../expandContract/ExpandTensorNField.C | 168 +++ .../expandContract/ExpandTensorNField.H | 193 ++++ .../OpenFOAM/expandContract/ExpandTensorNI.H | 322 ++++++ src/VectorN/OpenFOAM/primitives/DiagTensorN.H | 122 +++ .../OpenFOAM/primitives/DiagTensorNI.H | 409 ++++++++ .../OpenFOAM/primitives/SphericalTensorN.H | 115 ++ .../OpenFOAM/primitives/SphericalTensorNI.H | 274 +++++ src/VectorN/OpenFOAM/primitives/TensorN.H | 150 +++ src/VectorN/OpenFOAM/primitives/TensorNI.H | 985 ++++++++++++++++++ src/VectorN/OpenFOAM/primitives/VectorN.H | 118 +++ src/VectorN/OpenFOAM/primitives/VectorNI.H | 204 ++++ .../OpenFOAM/primitives/vector2/diagTensor2.H | 66 ++ .../primitives/vector2/diagTensor2I.H | 151 +++ .../primitives/vector2/sphericalTensor2.H | 65 ++ .../primitives/vector2/sphericalTensor2I.H | 88 ++ .../OpenFOAM/primitives/vector2/tensor2.H | 67 ++ .../OpenFOAM/primitives/vector2/tensor2I.H | 221 ++++ .../OpenFOAM/primitives/vector2/vector2.H | 66 ++ .../OpenFOAM/primitives/vector4/diagTensor4.H | 63 ++ .../primitives/vector4/sphericalTensor4.H | 62 ++ .../OpenFOAM/primitives/vector4/tensor4.H | 67 ++ .../OpenFOAM/primitives/vector4/tensor4I.H | 103 ++ .../OpenFOAM/primitives/vector4/vector4.H | 66 ++ .../OpenFOAM/primitives/vector6/diagTensor6.H | 63 ++ .../primitives/vector6/sphericalTensor6.H | 62 ++ .../OpenFOAM/primitives/vector6/tensor6.H | 64 ++ .../OpenFOAM/primitives/vector6/vector6.H | 66 ++ .../OpenFOAM/primitives/vector8/diagTensor8.H | 63 ++ .../primitives/vector8/sphericalTensor8.H | 62 ++ .../OpenFOAM/primitives/vector8/tensor8.H | 64 ++ .../OpenFOAM/primitives/vector8/vector8.H | 66 ++ .../calculatedFvPatchVectorNFields.C | 56 + .../calculatedFvPatchVectorNFields.H | 38 + .../calculatedFvPatchVectorNFieldsFwd.H | 62 ++ .../coupledFvPatchVectorNFields.C | 55 + .../coupledFvPatchVectorNFields.H | 39 + .../coupledFvPatchVectorNFieldsFwd.H | 62 ++ .../fvPatchFields/emptyFvPatchVectorNFields.C | 55 + .../fvPatchFields/emptyFvPatchVectorNFields.H | 40 + .../emptyFvPatchVectorNFieldsFwd.H | 62 ++ .../fixedValueFvPatchVectorNFields.C | 55 + .../fixedValueFvPatchVectorNFields.H | 40 + .../fixedValueFvPatchVectorNFieldsFwd.H | 62 ++ .../fvPatchFields/fvPatchVectorNFields.C | 67 ++ .../fvPatchFields/fvPatchVectorNFields.H | 38 + .../fvPatchFields/fvPatchVectorNFieldsFwd.H | 62 ++ .../genericFvPatchVectorNFields.C | 56 + .../genericFvPatchVectorNFields.H | 61 ++ .../processorFvPatchVectorNFields.C | 108 ++ .../processorFvPatchVectorNFields.H | 40 + .../processorFvPatchVectorNFieldsFwd.H | 56 + .../transformFvPatchVectorNFields.C | 54 + .../transformFvPatchVectorNFields.H | 41 + .../transformFvPatchVectorNFieldsFwd.H | 58 ++ .../fvPatchFields/wedgeFvPatchVectorNFields.C | 94 ++ .../fvPatchFields/wedgeFvPatchVectorNFields.H | 74 ++ .../wedgeFvPatchVectorNFieldsFwd.H | 62 ++ .../zeroGradientFvPatchVectorNFields.C | 55 + .../zeroGradientFvPatchVectorNFields.H | 40 + .../zeroGradientFvPatchVectorNFieldsFwd.H | 62 ++ .../calculatedFvsPatchVectorNFields.C | 55 + .../calculatedFvsPatchVectorNFields.H | 38 + .../calculatedFvsPatchVectorNFieldsFwd.H | 68 ++ .../coupledFvsPatchVectorNFields.C | 55 + .../coupledFvsPatchVectorNFields.H | 38 + .../coupledFvsPatchVectorNFieldsFwd.H | 67 ++ .../emptyFvsPatchVectorNFields.C | 55 + .../emptyFvsPatchVectorNFields.H | 38 + .../emptyFvsPatchVectorNFieldsFwd.H | 62 ++ .../fvsPatchFields/fvsPatchVectorNFields.C | 66 ++ .../fvsPatchFields/fvsPatchVectorNFields.H | 38 + .../fvsPatchFields/fvsPatchVectorNFieldsFwd.H | 69 ++ .../processorFvsPatchVectorNFields.C | 49 + .../processorFvsPatchVectorNFields.H | 38 + .../processorFvsPatchVectorNFieldsFwd.H | 61 ++ .../wedgeFvsPatchVectorNFields.C | 55 + .../wedgeFvsPatchVectorNFields.H | 38 + .../wedgeFvsPatchVectorNFieldsFwd.H | 62 ++ .../surfaceFields/surfaceVectorNFields.C | 56 + .../surfaceFields/surfaceVectorNFields.H | 47 + .../surfaceFields/surfaceVectorNFieldsFwd.H | 78 ++ .../fields/volFields/volVectorNFields.C | 56 + .../fields/volFields/volVectorNFields.H | 47 + .../fields/volFields/volVectorNFieldsFwd.H | 78 ++ .../VectorNSurfaceInterpolationSchemes.C | 76 ++ 133 files changed, 11866 insertions(+) create mode 100644 src/VectorN/Make/files create mode 100644 src/VectorN/Make/options create mode 100644 src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNLduInterfaceFields.C create mode 100644 src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.C create mode 100644 src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.H create mode 100644 src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNSolvers.C create mode 100644 src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.C create mode 100644 src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.H create mode 100644 src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorNI.H create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.C create mode 100644 src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.H create mode 100644 src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.C create mode 100644 src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.H create mode 100644 src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.C create mode 100644 src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.H create mode 100644 src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.C create mode 100644 src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.H create mode 100644 src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.C create mode 100644 src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.H create mode 100644 src/VectorN/OpenFOAM/FieldFields/VectorTensorNFieldFieldsFwd.H create mode 100644 src/VectorN/OpenFOAM/Fields/DiagTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/Fields/DiagTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/Fields/TensorNFields.C create mode 100644 src/VectorN/OpenFOAM/Fields/TensorNFields.H create mode 100644 src/VectorN/OpenFOAM/Fields/VectorNFieldTypes.H create mode 100644 src/VectorN/OpenFOAM/Fields/VectorNFields.C create mode 100644 src/VectorN/OpenFOAM/Fields/VectorNFields.H create mode 100644 src/VectorN/OpenFOAM/Fields/VectorTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/Fields/VectorTensorNFieldsFwd.H create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.C create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.H create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.C create mode 100644 src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.H create mode 100644 src/VectorN/OpenFOAM/Lists/VectorNLists.C create mode 100644 src/VectorN/OpenFOAM/Lists/VectorNLists.H create mode 100644 src/VectorN/OpenFOAM/expandContract/ExpandTensorN.H create mode 100644 src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.C create mode 100644 src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.H create mode 100644 src/VectorN/OpenFOAM/expandContract/ExpandTensorNI.H create mode 100644 src/VectorN/OpenFOAM/primitives/DiagTensorN.H create mode 100644 src/VectorN/OpenFOAM/primitives/DiagTensorNI.H create mode 100644 src/VectorN/OpenFOAM/primitives/SphericalTensorN.H create mode 100644 src/VectorN/OpenFOAM/primitives/SphericalTensorNI.H create mode 100644 src/VectorN/OpenFOAM/primitives/TensorN.H create mode 100644 src/VectorN/OpenFOAM/primitives/TensorNI.H create mode 100644 src/VectorN/OpenFOAM/primitives/VectorN.H create mode 100644 src/VectorN/OpenFOAM/primitives/VectorNI.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector2/diagTensor2.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector2/diagTensor2I.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector2/sphericalTensor2.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector2/sphericalTensor2I.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector2/tensor2.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector2/tensor2I.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector2/vector2.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector4/diagTensor4.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector4/sphericalTensor4.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector4/tensor4.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector4/tensor4I.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector4/vector4.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector6/diagTensor6.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector6/sphericalTensor6.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector6/tensor6.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector6/vector6.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector8/diagTensor8.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector8/sphericalTensor8.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector8/tensor8.H create mode 100644 src/VectorN/OpenFOAM/primitives/vector8/vector8.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/calculatedFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/calculatedFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/calculatedFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/coupledFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/coupledFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/coupledFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/emptyFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/emptyFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/emptyFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/fixedValueFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/fixedValueFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/fixedValueFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/fvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/genericFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/genericFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/processorFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/processorFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/processorFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/transformFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/transformFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/transformFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/wedgeFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/wedgeFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/wedgeFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/zeroGradientFvPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/zeroGradientFvPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvPatchFields/zeroGradientFvPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/calculatedFvsPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/calculatedFvsPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/calculatedFvsPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/coupledFvsPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/coupledFvsPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/coupledFvsPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/emptyFvsPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/emptyFvsPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/emptyFvsPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/processorFvsPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/processorFvsPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/processorFvsPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/wedgeFvsPatchVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/wedgeFvsPatchVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/fvsPatchFields/wedgeFvsPatchVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/surfaceFields/surfaceVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/surfaceFields/surfaceVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/surfaceFields/surfaceVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/fields/volFields/volVectorNFields.C create mode 100644 src/VectorN/finiteVolume/fields/volFields/volVectorNFields.H create mode 100644 src/VectorN/finiteVolume/fields/volFields/volVectorNFieldsFwd.H create mode 100644 src/VectorN/finiteVolume/interpolation/VectorNSurfaceInterpolationSchemes.C diff --git a/src/VectorN/Make/files b/src/VectorN/Make/files new file mode 100644 index 000000000..951d26f0d --- /dev/null +++ b/src/VectorN/Make/files @@ -0,0 +1,39 @@ +OpenFOAM/Lists/VectorNLists.C + +OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.C + +OpenFOAM/Fields/VectorNFields.C +OpenFOAM/Fields/TensorNFields.C +OpenFOAM/Fields/DiagTensorNFields.C +OpenFOAM/Fields/SphericalTensorNFields.C + +OpenFOAM/expandContract/ExpandTensorNField.C + +OpenFOAM/BlockLduMatrices/blockVectorNSolvers.C +OpenFOAM/BlockLduMatrices/blockVectorNMatrices.C +OpenFOAM/BlockLduMatrices/blockVectorNLduInterfaceFields.C + +finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/genericFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/calculatedFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/emptyFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/transformFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/wedgeFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/coupledFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/processorFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/fixedValueFvPatchVectorNFields.C +finiteVolume/fields/fvPatchFields/zeroGradientFvPatchVectorNFields.C + +finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFields.C +finiteVolume/fields/fvsPatchFields/calculatedFvsPatchVectorNFields.C +finiteVolume/fields/fvsPatchFields/emptyFvsPatchVectorNFields.C +finiteVolume/fields/fvsPatchFields/wedgeFvsPatchVectorNFields.C +finiteVolume/fields/fvsPatchFields/coupledFvsPatchVectorNFields.C +finiteVolume/fields/fvsPatchFields/processorFvsPatchVectorNFields.C + +finiteVolume/fields/volFields/volVectorNFields.C +finiteVolume/fields/surfaceFields/surfaceVectorNFields.C + +finiteVolume/interpolation/VectorNSurfaceInterpolationSchemes.C + +LIB = $(FOAM_LIBBIN)/libVectorN diff --git a/src/VectorN/Make/options b/src/VectorN/Make/options new file mode 100644 index 000000000..79c9c2ed9 --- /dev/null +++ b/src/VectorN/Make/options @@ -0,0 +1,6 @@ +EXE_INC = \ + -I$(FOAM_SRC)/OpenFOAM/lnInclude \ + -I$(FOAM_SRC)/finiteVolume/lnInclude \ + -ftemplate-depth-200 + +LIB_LIBS = diff --git a/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNLduInterfaceFields.C b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNLduInterfaceFields.C new file mode 100644 index 000000000..a5a314e95 --- /dev/null +++ b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNLduInterfaceFields.C @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + blockVectorNLduInterfaceFields + +Description + +Author + +\*----------------------------------------------------------------------------*/ + +#include "BlockLduInterfaceField.H" +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +#define makeTemplateTypeNameAndDebug(type, Type, args...) \ + defineTemplateTypeNameAndDebug(BlockLduInterfaceField, 0); + +forAllVectorNTypes(makeTemplateTypeNameAndDebug); + +#undef makeTemplateTypeNameAndDebug + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.C b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.C new file mode 100644 index 000000000..7b647c1b8 --- /dev/null +++ b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Description + Block matrix member static data members + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +\*---------------------------------------------------------------------------*/ + +#include "blockVectorNMatrices.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +#define makeNamedTemplateTypeNameAndDebug(type, Type, args...) \ + defineNamedTemplateTypeNameAndDebug(block##Type##Matrix, 0); + +forAllVectorNTypes(makeNamedTemplateTypeNameAndDebug); + +#undef makeNamedTemplateTypeNameAndDebug + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.H b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.H new file mode 100644 index 000000000..eaf68f5cb --- /dev/null +++ b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNMatrices.H @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + BlockLduMatrix + +Description + Typedefs for block matrices + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +\*---------------------------------------------------------------------------*/ + +#ifndef blockVectorNMatrices_H +#define blockVectorNMatrices_H + +#include "blockLduMatrices.H" +#include "VectorTensorNFieldsFwd.H" +#include "ExpandTensorNField.H" +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +#define makeTypedef(type, Type, args...) \ + typedef BlockLduMatrix block##Type##Matrix; + +forAllVectorNTypes(makeTypedef) + +#undef makeTypedef + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNSolvers.C b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNSolvers.C new file mode 100644 index 000000000..44336037e --- /dev/null +++ b/src/VectorN/OpenFOAM/BlockLduMatrices/blockVectorNSolvers.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +\*---------------------------------------------------------------------------*/ + +#include "blockLduMatrices.H" +#include "addToRunTimeSelectionTable.H" + +#include "blockLduPrecons.H" +#include "BlockNoPrecon.H" +#include "blockDiagonalPrecons.H" +#include "blockGaussSeidelPrecons.H" +#include "BlockCholeskyPrecon.H" + +#include "blockLduSmoothers.H" +#include "blockGaussSeidelSmoothers.H" +#include "BlockILUSmoother.H" + +#include "blockLduSolvers.H" +#include "BlockDiagonalSolver.H" +#include "BlockBiCGStabSolver.H" +#include "BlockCGSolver.H" +#include "BlockGaussSeidelSolver.H" +#include "BlockGMRESSolver.H" + +#include "VectorTensorNFields.H" +#include "ExpandTensorN.H" +#include "ExpandTensorNField.H" +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +#define makeSolver(type, Type, args...) \ +/* Preconditioners */ \ +typedef BlockLduPrecon block##Type##Precon; \ +defineNamedTemplateTypeNameAndDebug(block##Type##Precon, 0); \ +defineTemplateRunTimeSelectionTable(block##Type##Precon, dictionary); \ + \ +typedef BlockNoPrecon block##Type##NoPrecon; \ +makeBlockPrecon(block##Type##Precon, block##Type##NoPrecon); \ + \ +typedef BlockDiagonalPrecon block##Type##DiagonalPrecon; \ +makeBlockPrecon(block##Type##Precon, block##Type##DiagonalPrecon); \ + \ +typedef BlockGaussSeidelPrecon block##Type##GaussSeidelPrecon; \ +makeBlockPrecon(block##Type##Precon, block##Type##GaussSeidelPrecon); \ + \ +typedef BlockCholeskyPrecon block##Type##CholeskyPrecon; \ +makeBlockPrecon(block##Type##Precon, block##Type##CholeskyPrecon); \ + \ + \ +/* Smoothers */ \ +typedef BlockLduSmoother block##Type##Smoother; \ +defineNamedTemplateTypeNameAndDebug(block##Type##Smoother, 0); \ +defineTemplateRunTimeSelectionTable(block##Type##Smoother, dictionary); \ + \ +typedef BlockGaussSeidelSmoother block##Type##GaussSeidelSmoother; \ +makeBlockSmoother(block##Type##Smoother, block##Type##GaussSeidelSmoother); \ + \ +typedef BlockILUSmoother block##Type##ILUSmoother; \ +makeBlockSmoother(block##Type##Smoother, block##Type##ILUSmoother); \ + \ + \ +/* Solvers */ \ +typedef BlockLduSolver block##Type##Solver; \ +defineNamedTemplateTypeNameAndDebug(block##Type##Solver, 0); \ +defineTemplateRunTimeSelectionTable \ +( \ + block##Type##Solver, \ + symMatrix \ +); \ + \ +defineTemplateRunTimeSelectionTable \ +( \ + block##Type##Solver, \ + asymMatrix \ +); \ + \ +typedef BlockDiagonalSolver block##Type##DiagonalSolver; \ +defineNamedTemplateTypeNameAndDebug(block##Type##DiagonalSolver, 0); \ + \ +typedef BlockBiCGStabSolver block##Type##BiCGStabSolver; \ +makeBlockSolverTypeName(block##Type##BiCGStabSolver); \ +addSolverToBlockMatrix(Type, block##Type##BiCGStabSolver, symMatrix); \ +addSolverToBlockMatrix(Type, block##Type##BiCGStabSolver, asymMatrix); \ + \ +typedef BlockCGSolver block##Type##CGSolver; \ +makeBlockSolverTypeName(block##Type##CGSolver); \ +addSolverToBlockMatrix(Type, block##Type##CGSolver, symMatrix); \ + \ +typedef BlockGaussSeidelSolver block##Type##GaussSeidelSolver; \ +makeBlockSolverTypeName(block##Type##GaussSeidelSolver); \ +addSolverToBlockMatrix(Type, block##Type##GaussSeidelSolver, symMatrix); \ + \ +typedef BlockGMRESSolver block##Type##GMRESSolver; \ +makeBlockSolverTypeName(block##Type##GMRESSolver); \ +addSolverToBlockMatrix(Type, block##Type##GMRESSolver, symMatrix); \ +addSolverToBlockMatrix(Type, block##Type##GMRESSolver, asymMatrix); + + +forAllVectorNTypes(makeSolver) + +#undef makeSolver + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.C b/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.C new file mode 100644 index 000000000..cbf136ce2 --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.C @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Dimensioned VectorN and TensorN obtained from generic dimensioned type. + +\*---------------------------------------------------------------------------*/ + +#include "dimensionedVectorTensorN.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define UNARY_FUNCTION(returnType, type, fun, text) \ +inline returnType fun(const type& t) \ +{ \ + return returnType \ + ( \ + #text "(" + t.name() + ')', \ + fun(t.dimensions()), \ + fun(t.value()) \ + ); \ +} + +#define dimensionedType_Funs(cmptType, vectorType, tensorType, \ + diagTensorType, sphericalTensorType) \ +UNARY_FUNCTION(tensorType, tensorType, inv, inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType, inv, inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, inv, inv) \ +UNARY_FUNCTION(diagTensorType, tensorType, diag, diag) \ +UNARY_FUNCTION(diagTensorType, diagTensorType, diag, diag) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, diag, diag)\ +UNARY_FUNCTION(cmptType, vectorType, cmptSum, cmptSum) + +#define dimensionedVectorN_Funs(length) \ +dimensionedType_Funs \ +( \ + dimensionedScalar, \ + dimensionedVector##length, \ + dimensionedTensor##length, \ + dimensionedDiagTensor##length, \ + dimensionedSphericalTensor##length \ +) + +dimensionedVectorN_Funs(2) +dimensionedVectorN_Funs(4) +dimensionedVectorN_Funs(6) +dimensionedVectorN_Funs(8) + +#undef dimensionedVectorN_Funs +#undef dimensionedType_Funs +#undef UNARY_FUNCTION + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.H b/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.H new file mode 100644 index 000000000..99632710c --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorN.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + dimensionedVectorTensorN + +Description + Dimensioned VectorN and TensorN obtained from generic dimensioned type. + +Author + Ivor Clifford + +SourceFiles + dimensionedVectorTensorN.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dimensionedVectorTensorN_H +#define dimensionedVectorTensorN_H + +#include "dimensionedType.H" +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +#define doMakeTypedef(type, Type, args...) \ + typedef dimensioned dimensioned##Type; + +forAllVectorNTypes(doMakeTypedef) + +forAllTensorNTypes(doMakeTypedef) + +forAllDiagTensorNTypes(doMakeTypedef) + +forAllSphericalTensorNTypes(doMakeTypedef) + +#undef doMakeTypedef + + +// friend functions + +dimensionSet diag(const dimensionSet& ds); +dimensionSet cmptSum(const dimensionSet& ds); +dimensionSet contractLinear(const dimensionSet& ds); +dimensionSet contractScalar(const dimensionSet& ds); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define dimensionedType_Funs(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, cmptType, args...) \ + \ +tensorType inv(const tensorType&); \ +diagTensorType inv(const diagTensorType&); \ +sphericalTensorType inv(const sphericalTensorType&); \ + \ +tensorType inv(const tensorType&); \ +diagTensorType inv(const diagTensorType&); \ +sphericalTensorType inv(const sphericalTensorType&); \ + \ +cmptType cmptSum(const vectorType&); + +#define dimensionedVectorN_Funs(length) \ +dimensionedType_Funs \ +( \ + dimensionedScalar, \ + dimensionedVector##length, \ + dimensionedTensor##length, \ + dimensionedDiagTensor##length, \ + dimensionedSphericalTensor##length \ +) + +forAllVectorTensorNTypes(dimensionedType_Funs) + +#undef dimensionedVectorN_Funs +#undef dimensionedType_Funs + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "dimensionedVectorTensorNI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorNI.H b/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorNI.H new file mode 100644 index 000000000..86a56a9f9 --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensionedTypes/dimensionedVectorTensorNI.H @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + dimensionedVectorTensorN + +Description + +Author + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + +inline dimensionSet diag(const dimensionSet& ds) +{ + return ds; +} + +inline dimensionSet cmptSum(const dimensionSet& ds) +{ + return ds; +} + +inline dimensionSet contractLinear(const dimensionSet& ds) +{ + return ds; +} + +inline dimensionSet contractScalar(const dimensionSet& ds) +{ + return ds; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.C b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.C new file mode 100644 index 000000000..3cfc1130c --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "DimensionedDiagTensorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType,diag,diag) \ +UNARY_FUNCTION(vectorType, diagTensorType, contractLinear,contractLinear) \ +UNARY_FUNCTION(CmptType, diagTensorType, contractScalar,contractLinear) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+',add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'+', subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.H b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.H new file mode 100644 index 000000000..607ab10b2 --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedDiagTensorNFields.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + DimensionedDiagTensorNFields + +Description + Specialisation of DimensionedField for DiagTensorN + +SourceFiles + DimensionedDiagTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DimensionedDiagTensorNFields_H +#define DimensionedDiagTensorNFields_H + +#include "DimensionedField.H" +#include "dimensionedVectorTensorN.H" +#include "VectorTensorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType,diag,diag) \ +UNARY_FUNCTION(vectorType, diagTensorType, contractLinear,contractLinear) \ +UNARY_FUNCTION(CmptType, diagTensorType, contractScalar,contractLinear) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+',add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'+', subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "DimensionedDiagTensorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.C b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.C new file mode 100644 index 000000000..e5535802d --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.C @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "DimensionedSphericalTensorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,inv,inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,diag,diag) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractLinear,contractLinear) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractScalar,contractLinear) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.H b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.H new file mode 100644 index 000000000..c90f82821 --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedSphericalTensorNFields.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + DimensionedSphericalTensorNFields + +Description + Specialisation of DimensionedField for SphericalTensorN. + +SourceFiles + DimensionedSphericalTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DimensionedSphericalTensorNFields_H +#define DimensionedSphericalTensorNFields_H + +#include "DimensionedField.H" +#include "dimensionedVectorTensorN.H" +#include "VectorTensorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,inv,inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,diag,diag) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractLinear,contractLinear) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractScalar,contractLinear) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "DimensionedSphericalTensorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.C b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.C new file mode 100644 index 000000000..4589c1a1a --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "DimensionedTensorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, tensorType,diag,diag) \ +UNARY_FUNCTION(tensorType, tensorType, negSumDiag, negSumDiag) \ +UNARY_FUNCTION(vectorType, tensorType, contractLinear,contractLinear) \ +UNARY_FUNCTION(CmptType, tensorType, contractScalar,contractLinear) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.H b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.H new file mode 100644 index 000000000..8ba259f9d --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedTensorNFields.H @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + DimensionedTensorNFields + +Description + Specialisation of DimensionedField for TensorN. + +SourceFiles + DimensionedTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DimensionedTensorNFields_H +#define DimensionedTensorNFields_H + +#include "DimensionedField.H" +#include "dimensionedVectorTensorN.H" +#include "VectorTensorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, tensorType,diag,diag) \ +UNARY_FUNCTION(tensorType, tensorType, negSumDiag, negSumDiag) \ +UNARY_FUNCTION(vectorType, tensorType, contractLinear,contractLinear) \ +UNARY_FUNCTION(CmptType, tensorType, contractScalar,contractLinear) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "DimensionedTensorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.C b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.C new file mode 100644 index 000000000..6d9143e79 --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "DimensionedVectorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "undefFieldFunctionsM.H" + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.H b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.H new file mode 100644 index 000000000..93d9b7a3b --- /dev/null +++ b/src/VectorN/OpenFOAM/DimensonedFields/DimensionedVectorNFields.H @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + DimensionedVectorNFields + +Description + Specialisations of DimensionedField for VectorN types. + +SourceFiles + DimensionedVectorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DimensionedVectorNFields_H +#define DimensionedVectorNFields_H + +#include "DimensionedField.H" +#include "dimensionedVectorTensorN.H" +#include "VectorTensorNFields.H" + +#define TEMPLATE template +#include "DimensionedFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "DimensionedVectorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.C b/src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.C new file mode 100644 index 000000000..5f782acc6 --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "DiagTensorNFieldFields.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType, inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType, diag) \ +UNARY_FUNCTION(vectorType, diagTensorType, contractLinear) \ +UNARY_FUNCTION(CmptType, diagTensorType, contractScalar) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.H b/src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.H new file mode 100644 index 000000000..d5f6bb2c9 --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/DiagTensorNFieldFields.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + DiagTensorNFieldFields + +Description + Specialisation of FieldField for DiagTensorN + +SourceFiles + DiagTensorNFieldFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DiagTensorNFieldFields_H +#define DiagTensorNFieldFields_H + +#include "VectorTensorNFieldFieldsFwd.H" +#include "FieldField.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType, inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType, diag) \ +UNARY_FUNCTION(vectorType, diagTensorType, contractLinear) \ +UNARY_FUNCTION(CmptType, diagTensorType, contractScalar) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) \ + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "DiagTensorNFieldFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.C b/src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.C new file mode 100644 index 000000000..4ecbaaa39 --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.C @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "SphericalTensorNFieldFields.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, diag) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractLinear) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractScalar) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.H b/src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.H new file mode 100644 index 000000000..6c07def1f --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/SphericalTensorNFieldFields.H @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + SphericalTensorNFieldFields + +Description + Specialisation of FieldField for SphericalTensorN. + +SourceFiles + SphericalTensorNFieldFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SphericalTensorNFieldFields_H +#define SphericalTensorNFieldFields_H + +#include "VectorTensorNFieldFieldsFwd.H" +#include "FieldField.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, diag) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractLinear) \ +UNARY_FUNCTION(CmptType, sphericalTensorType, contractScalar) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "SphericalTensorNFieldFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.C b/src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.C new file mode 100644 index 000000000..c8d35682b --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "TensorNFieldFields.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType, inv) \ +UNARY_FUNCTION(diagTensorType, tensorType, diag) \ +UNARY_FUNCTION(tensorType, tensorType, negSumDiag) \ +UNARY_FUNCTION(vectorType, tensorType, contractLinear) \ +UNARY_FUNCTION(CmptType, tensorType, contractScalar) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.H b/src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.H new file mode 100644 index 000000000..7c798bae9 --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/TensorNFieldFields.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + tensorNFieldFields + +Description + Specialisation of FieldField for TensorN. + +SourceFiles + TensorNFieldFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TensorNFieldFields_H +#define TensorNFieldFields_H + +#include "VectorTensorNFieldFieldsFwd.H" +#include "FieldField.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType, inv) \ +UNARY_FUNCTION(diagTensorType, tensorType, diag) \ +UNARY_FUNCTION(tensorType, tensorType, negSumDiag) \ +UNARY_FUNCTION(vectorType, tensorType, contractLinear) \ +UNARY_FUNCTION(CmptType, tensorType, contractScalar) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "TensorNFieldFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.C b/src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.C new file mode 100644 index 000000000..f5e248d02 --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "VectorNFieldFields.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, vectorType, CmptType, /,divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, CmptType, /,divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -, subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.H b/src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.H new file mode 100644 index 000000000..94289b24a --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/VectorNFieldFields.H @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + VectorNFieldFields + +Description + Specialisations of FieldField for VectorN types. + +SourceFiles + VectorNFieldFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef VectorNFieldFields_H +#define VectorNFieldFields_H + +#include "VectorTensorNFieldFieldsFwd.H" +#include "FieldField.H" + +#define TEMPLATE template class Field> +#include "FieldFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, vectorType, CmptType, /,divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, CmptType, /,divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -, subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "VectorNFieldFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/FieldFields/VectorTensorNFieldFieldsFwd.H b/src/VectorN/OpenFOAM/FieldFields/VectorTensorNFieldFieldsFwd.H new file mode 100644 index 000000000..93cac1a5f --- /dev/null +++ b/src/VectorN/OpenFOAM/FieldFields/VectorTensorNFieldFieldsFwd.H @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + VectorTensorNFieldFieldsFwd + +Description + +Author + +SourceFiles + +\*---------------------------------------------------------------------------*/ + +#ifndef VectorTensorNFieldFieldsFwd_H +#define VectorTensorNFieldFieldsFwd_H + +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template class Field, class Type> +class FieldField; + +#define makeTypedef(Type, args...) \ + typedef FieldField Type##FieldField; + +forAllVectorNTypes(makeTypedef) + +forAllTensorNTypes(makeTypedef) + +forAllDiagTensorNTypes(makeTypedef) + +forAllSphericalTensorNTypes(makeTypedef) + +#undef makeTypedef + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/DiagTensorNFields.C b/src/VectorN/OpenFOAM/Fields/DiagTensorNFields.C new file mode 100644 index 000000000..88bda99a2 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/DiagTensorNFields.C @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "DiagTensorNFields.H" +#include "transformField.H" + +#define TEMPLATE +#include "FieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType, inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType, diag) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) \ + \ +template<> \ +tmp > transformFieldMask \ +( \ + const Field& stf \ +) \ +{ \ + tmp > tRes( new Field(stf.size()) ); \ + Field& res = tRes(); \ + TFOR_ALL_F_OP_F(diagTensorType, res, =, sphericalTensorType, stf) \ + return tRes; \ +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/DiagTensorNFields.H b/src/VectorN/OpenFOAM/Fields/DiagTensorNFields.H new file mode 100644 index 000000000..eb042797f --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/DiagTensorNFields.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + DiagTensorNFields + +Description + Specialisation of Field for DiagTensorN + +SourceFiles + DiagTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DiagTensorNFields_H +#define DiagTensorNFields_H + +#include "VectorTensorNFieldsFwd.H" +#include "Field.H" + +#define TEMPLATE +#include "FieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType, inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType, diag) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /, divide)\ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -, subtract) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.C b/src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.C new file mode 100644 index 000000000..ca58638e3 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "SphericalTensorNFields.H" +#include "transformField.H" + +#define TEMPLATE +#include "FieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, diag) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.H b/src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.H new file mode 100644 index 000000000..2c613cd3f --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/SphericalTensorNFields.H @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + SphericalTensorNFields + +Description + Specialisation of Field for SphericalTensorN. + +SourceFiles + SphericalTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SphericalTensorNFields_H +#define SphericalTensorNFields_H + +#include "VectorTensorNFieldsFwd.H" +#include "Field.H" + +#define TEMPLATE +#include "FieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType, diag) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -, subtract) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/TensorNFields.C b/src/VectorN/OpenFOAM/Fields/TensorNFields.C new file mode 100644 index 000000000..0803d3b12 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/TensorNFields.C @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "TensorNFields.H" +#include "transformField.H" + +#define TEMPLATE +#include "FieldFunctionsM.C" +#include "ExpandTensorN.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType,diagTensorType, \ + sphericalTensorType,vectorType,CmptType, \ + args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType, inv) \ +UNARY_FUNCTION(diagTensorType, tensorType, diag) \ +UNARY_FUNCTION(tensorType, tensorType, negSumDiag) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, -, subtract) \ + \ +template<> \ +tmp > transformFieldMask \ +( \ + const Field& dtf \ +) \ +{ \ + tmp > tRes(new Field(dtf.size())); \ + Field& res = tRes(); \ + TFOR_ALL_F_OP_F(tensorType, res, =, diagTensorType, dtf) \ + return tRes; \ +} \ + \ +template<> \ +tmp > transformFieldMask \ +( \ + const Field& stf \ +) \ +{ \ + tmp > tRes(new Field(stf.size())); \ + Field& res = tRes(); \ + TFOR_ALL_F_OP_F(tensorType, res, =, sphericalTensorType, stf) \ + return tRes; \ +} \ + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/TensorNFields.H b/src/VectorN/OpenFOAM/Fields/TensorNFields.H new file mode 100644 index 000000000..7c78647f2 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/TensorNFields.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + tensorNFields + +Description + Specialisation of Field for TensorN. + +SourceFiles + TensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TensorNFields_H +#define TensorNFields_H + +#include "VectorTensorNFieldsFwd.H" +#include "Field.H" + +#define TEMPLATE +#include "FieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType,diagTensorType, \ + sphericalTensorType,vectorType,CmptType, \ + args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType, inv) \ +UNARY_FUNCTION(diagTensorType, tensorType, diag) \ +UNARY_FUNCTION(tensorType, tensorType, negSumDiag) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /, divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -, subtract) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, +, add) \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, +, add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, -, subtract) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/VectorNFieldTypes.H b/src/VectorN/OpenFOAM/Fields/VectorNFieldTypes.H new file mode 100644 index 000000000..971b6dd09 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/VectorNFieldTypes.H @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Include the header files for all the primitive types that Fields are + instantiated for. + +\*---------------------------------------------------------------------------*/ + +#ifndef VectorNFieldTypes_H +#define VectorNFieldTypes_H + +#include "vector2.H" +#include "vector4.H" +#include "vector6.H" +#include "vector8.H" + +#include "tensor2.H" +#include "tensor4.H" +#include "tensor6.H" +#include "tensor8.H" + +#include "diagTensor2.H" +#include "diagTensor4.H" +#include "diagTensor6.H" +#include "diagTensor8.H" + +#define forAllVectorNTypes(m, args...) \ + m(vector2, Vector2, args) \ + m(vector4, Vector4, args) \ + m(vector6, Vector6, args) \ + m(vector8, Vector8, args) + +#define forAllTensorNTypes(m, args...) \ + m(tensor2, Tensor2, args) \ + m(tensor4, Tensor4, args) \ + m(tensor6, Tensor6, args) \ + m(tensor8, Tensor8, args) + +#define forAllDiagTensorNTypes(m, args...) \ + m(diagTensor2, DiagTensor2, args) \ + m(diagTensor4, DiagTensor4, args) \ + m(diagTensor6, DiagTensor6, args) \ + m(diagTensor8, DiagTensor8, args) + +#define forAllSphericalTensorNTypes(m, args...) \ + m(sphericalTensor2, SphericalTensor2, args) \ + m(sphericalTensor4, SphericalTensor4, args) \ + m(sphericalTensor6, SphericalTensor6, args) \ + m(sphericalTensor8, SphericalTensor8, args) + +#define forAllVectorTensorNTypes(m, args...) \ + m(tensor2, diagTensor2, sphericalTensor2, vector2, scalar, args) \ + m(tensor4, diagTensor4, sphericalTensor4, vector4, scalar, args) \ + m(tensor6, diagTensor6, sphericalTensor6, vector6, scalar, args) \ + m(tensor8, diagTensor8, sphericalTensor8, vector8, scalar, args) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/VectorNFields.C b/src/VectorN/OpenFOAM/Fields/VectorNFields.C new file mode 100644 index 000000000..7a52f79fe --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/VectorNFields.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "VectorNFields.H" + +#define TEMPLATE +#include "FieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType,diagTensorType, \ + sphericalTensorType,vectorType,CmptType, \ + args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -, subtract) \ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/VectorNFields.H b/src/VectorN/OpenFOAM/Fields/VectorNFields.H new file mode 100644 index 000000000..3c04d0b41 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/VectorNFields.H @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + VectorNFields + +Description + Specialisations of Field for VectorN types. + +SourceFiles + VectorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef VectorNFields_H +#define VectorNFields_H + +#include "VectorTensorNFieldsFwd.H" +#include "Field.H" + +#define TEMPLATE +#include "FieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType,diagTensorType, \ + sphericalTensorType,vectorType,CmptType, \ + args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, /, divide) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /, divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -, subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +, add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -, subtract) \ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/VectorTensorNFields.H b/src/VectorN/OpenFOAM/Fields/VectorTensorNFields.H new file mode 100644 index 000000000..f4e68a089 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/VectorTensorNFields.H @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + VectorTensorNFields + +Description + Specialisations of Field for VectorN and TensorN types. + +\*---------------------------------------------------------------------------*/ + +#ifndef VectorTensorNFields_H +#define VectorTensorNFields_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "VectorNFields.H" +#include "TensorNFields.H" +#include "DiagTensorNFields.H" +#include "SphericalTensorNFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Fields/VectorTensorNFieldsFwd.H b/src/VectorN/OpenFOAM/Fields/VectorTensorNFieldsFwd.H new file mode 100644 index 000000000..2d27030c5 --- /dev/null +++ b/src/VectorN/OpenFOAM/Fields/VectorTensorNFieldsFwd.H @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + VectorNFields + +Description + Forward declarations of the specialisations of Field for + TensorN types. + +\*---------------------------------------------------------------------------*/ + +#ifndef VectorNFieldsFwd_H +#define VectorNFieldsFwd_H + +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template class Field; + +#define makeTypedef(Type, args...) \ + typedef Field Type##Field; + +forAllVectorNTypes(makeTypedef) + +forAllTensorNTypes(makeTypedef) + +forAllDiagTensorNTypes(makeTypedef) + +forAllSphericalTensorNTypes(makeTypedef) + +#undef makeTypedef + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.C b/src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.C new file mode 100644 index 000000000..47b7f2217 --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "GeometricDiagTensorNFields.H" +#include "ExpandTensorNField.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType,diag,diag) \ +UNARY_FUNCTION(CmptType, diagTensorType,contractScalar,contractScalar) \ +UNARY_FUNCTION(vectorType, diagTensorType,contractLinear,contractLinear) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+',add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'+', subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.H b/src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.H new file mode 100644 index 000000000..7696bbf32 --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricDiagTensorNFields.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + GeometricDiagTensorNFields + +Description + Specialisation of GeometricField for DiagTensorN + +SourceFiles + GeometricDiagTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GeometricDiagTensorNFields_H +#define GeometricDiagTensorNFields_H + +#include "GeometricField.H" +#include "DimensionedDiagTensorNFields.H" +#include "DiagTensorNFieldFields.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define DiagTensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(diagTensorType, diagTensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, diagTensorType,diag,diag) \ +UNARY_FUNCTION(CmptType, diagTensorType,contractScalar,contractScalar) \ +UNARY_FUNCTION(vectorType, diagTensorType,contractLinear,contractLinear) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, CmptType, diagTensorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(diagTensorType, CmptType, diagTensorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+',add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, sphericalTensorType, diagTensorType, -,'-', subtract) \ + \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'-', subtract) \ + \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, +,'+', add) \ +BINARY_TYPE_OPERATOR(diagTensorType, diagTensorType, sphericalTensorType, -,'+', subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(DiagTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef DiagTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "GeometricDiagTensorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.C b/src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.C new file mode 100644 index 000000000..11cd7efda --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "GeometricSphericalTensorNFields.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,inv,inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,diag,diag) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.H b/src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.H new file mode 100644 index 000000000..0b9857cd4 --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricSphericalTensorNFields.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + GeometricSphericalTensorNFields + +Description + Specialisation of GeometricField for SphericalTensorN. + +SourceFiles + GeometricSphericalTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GeometricSphericalTensorNFields_H +#define GeometricSphericalTensorNFields_H + +#include "GeometricField.H" +#include "DimensionedSphericalTensorNFields.H" +#include "SphericalTensorNFieldFields.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define SphericalTensorN_FieldFunctions(tensorType, diagTensorType, \ + sphericalTensorType, vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,inv,inv) \ +UNARY_FUNCTION(sphericalTensorType, sphericalTensorType,diag,diag) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, CmptType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(sphericalTensorType, sphericalTensorType, sphericalTensorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(SphericalTensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef SphericalTensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "GeometricSphericalTensorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.C b/src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.C new file mode 100644 index 000000000..e6e3eb491 --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.C @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "GeometricTensorNFields.H" +#include "ExpandTensorNField.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, tensorType,diag,diag) \ +UNARY_FUNCTION(tensorType, tensorType,negSumDiag,negSumDiag) \ +UNARY_FUNCTION(CmptType, tensorType,contractScalar,contractScalar) \ +UNARY_FUNCTION(vectorType, tensorType,contractLinear,contractLinear) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.H b/src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.H new file mode 100644 index 000000000..7c6c56236 --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricTensorNFields.H @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + GeometricTensorNFields + +Description + Specialisation of GeometricField for TensorN. + +SourceFiles + GeometricTensorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GeometricTensorNFields_H +#define GeometricTensorNFields_H + +#include "GeometricField.H" +#include "DimensionedTensorNFields.H" +#include "TensorNFieldFields.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define TensorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(tensorType, tensorType,inv,inv) \ +UNARY_FUNCTION(diagTensorType, tensorType,diag,diag) \ +UNARY_FUNCTION(tensorType, tensorType,negSumDiag,negSumDiag) \ +UNARY_FUNCTION(CmptType, tensorType,contractScalar,contractScalar) \ +UNARY_FUNCTION(vectorType, tensorType,contractLinear,contractLinear) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, CmptType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, diagTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, sphericalTensorType, /,'|',divide) \ + \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, tensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, diagTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(tensorType, sphericalTensorType, tensorType, -,'-',subtract) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(TensorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef TensorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "GeometricTensorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.C b/src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.C new file mode 100644 index 000000000..d119f368d --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "GeometricVectorNFields.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.H b/src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.H new file mode 100644 index 000000000..b4572a47f --- /dev/null +++ b/src/VectorN/OpenFOAM/GeometricFields/GeometricVectorNFields.H @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + GeometricVectorNFields + +Description + Specialisations of GeometricField for VectorN types. + +SourceFiles + GeometricVectorNFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GeometricVectorNFields_H +#define GeometricVectorNFields_H + +#include "GeometricField.H" +#include "DimensionedVectorNFields.H" +#include "VectorNFieldFields.H" + +#define TEMPLATE template class PatchField, class GeoMesh> +#include "GeometricFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define VectorN_FieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, CmptType, args...) \ + \ +UNARY_FUNCTION(CmptType, vectorType, cmptSum, cmptSum) \ + \ +BINARY_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ +BINARY_TYPE_FUNCTION(vectorType, vectorType, vectorType, cmptMultiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, *,'*',multiply) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, *,'*',multiply) \ + \ +BINARY_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ +BINARY_TYPE_OPERATOR(vectorType, CmptType, vectorType, /,'|',divide) \ + \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) \ + \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, +,'+',add) \ +BINARY_TYPE_OPERATOR(vectorType, vectorType, vectorType, -,'-',subtract) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +forAllVectorTensorNTypes(VectorN_FieldFunctions) + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef VectorN_FieldFunctions + +#include "undefFieldFunctionsM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "GeometricVectorNFields.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Lists/VectorNLists.C b/src/VectorN/OpenFOAM/Lists/VectorNLists.C new file mode 100644 index 000000000..ae4ba2c09 --- /dev/null +++ b/src/VectorN/OpenFOAM/Lists/VectorNLists.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Specialisation of List for VectorN and TensorN types. + +\*---------------------------------------------------------------------------*/ + +#include "VectorNLists.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +#define makeListType(type, Type, args...) \ + defineCompoundTypeName(List, Type##List); \ + addCompoundToRunTimeSelectionTable(List, type##List); + +forAllVectorNTypes(makeListType) +forAllTensorNTypes(makeListType) +forAllDiagTensorNTypes(makeListType) +forAllSphericalTensorNTypes(makeListType) + +#undef makeListType + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/Lists/VectorNLists.H b/src/VectorN/OpenFOAM/Lists/VectorNLists.H new file mode 100644 index 000000000..9c910c3e3 --- /dev/null +++ b/src/VectorN/OpenFOAM/Lists/VectorNLists.H @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Type + VectorNLists + +Description + Specialisation of List for VectorN and TensorN types. + +\*---------------------------------------------------------------------------*/ + +#ifndef VectorNLists_H +#define VectorNLists_H + +#include "VectorNFieldTypes.H" +#include "List.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +#define makeListTypeDef(type, Type, args...) \ + typedef List type##List; + +forAllVectorNTypes(makeListTypeDef) +forAllTensorNTypes(makeListTypeDef) +forAllDiagTensorNTypes(makeListTypeDef) +forAllSphericalTensorNTypes(makeListTypeDef) + +#undef makeListTypeDef + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/expandContract/ExpandTensorN.H b/src/VectorN/OpenFOAM/expandContract/ExpandTensorN.H new file mode 100644 index 000000000..3d68af036 --- /dev/null +++ b/src/VectorN/OpenFOAM/expandContract/ExpandTensorN.H @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Global functions for expansion and contraction of tensorN coefficient + to diagonal and scalar type + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#ifndef expandTensorN_H +#define expandTensorN_H + +#include "VectorN.H" +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define UNARY_TEMPLATE_FUNCTION(ReturnType, Type, Func) \ +template \ +inline void Func(ReturnType&, const Type&); + +#define UNARY_TEMPLATE_FUNCTION_VS(ReturnType, Func) \ +template \ +inline void Func(ReturnType&, const Cmpt&); + +#define UNARY_TEMPLATE_FUNCTION_SV(Type, Func) \ +template \ +inline void Func(Cmpt&, const Type&); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +UNARY_TEMPLATE_FUNCTION_SV(TensorN, contractScalar) +UNARY_TEMPLATE_FUNCTION_SV(DiagTensorN, contractScalar) +UNARY_TEMPLATE_FUNCTION_SV(SphericalTensorN, contractScalar) +UNARY_TEMPLATE_FUNCTION_SV(VectorN, contractScalar) + +UNARY_TEMPLATE_FUNCTION(VectorN, TensorN, contractLinear) +UNARY_TEMPLATE_FUNCTION(VectorN, DiagTensorN, contractLinear) +UNARY_TEMPLATE_FUNCTION(VectorN, SphericalTensorN, contractLinear) + +UNARY_TEMPLATE_FUNCTION_VS(VectorN, expandScalar) +UNARY_TEMPLATE_FUNCTION_VS(TensorN, expandScalar) +UNARY_TEMPLATE_FUNCTION_VS(DiagTensorN, expandScalar) +UNARY_TEMPLATE_FUNCTION_VS(SphericalTensorN, expandScalar) + +UNARY_TEMPLATE_FUNCTION(TensorN, VectorN, expandLinear) +UNARY_TEMPLATE_FUNCTION(DiagTensorN, VectorN, expandLinear) +UNARY_TEMPLATE_FUNCTION(SphericalTensorN, VectorN, expandLinear) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ExpandTensorNI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef UNARY_TEMPLATE_FUNCTION +#undef UNARY_TEMPLATE_FUNCTION_VS +#undef UNARY_TEMPLATE_FUNCTION_SV + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.C b/src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.C new file mode 100644 index 000000000..ddb379780 --- /dev/null +++ b/src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.C @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Global functions for expansion and contraction of tensor field + to diagonal type + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#include "ExpandTensorNField.H" +#include "ExpandTensorN.H" +#include "Field.H" +#include "VectorNFieldTypes.H" +#include "FieldM.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define UNARY_FUNCTION(typeF1, typeF2, FUNC) \ + \ +void FUNC(Field& f1, const UList& f2) \ +{ \ + checkFields(f1, f2, #FUNC "(f1,f2)"); \ + \ + List_ACCESS(typeF1, f1, f1P); \ + List_CONST_ACCESS(typeF2, f2, f2P); \ + \ + List_FOR_ALL(f1,i) \ + FUNC(List_ELEM(f1, f1P, i), List_ELEM(f2, f2P, i)); \ + List_END_FOR_ALL \ +} \ + \ +void FUNC(Field& f1, const tmp >& tf2) \ +{ \ + FUNC(f1,tf2()); \ + tf2.clear(); \ +} + +#define ExpandFieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, cmptType, args...) \ + \ +UNARY_FUNCTION(cmptType, tensorType, contractScalar) \ +UNARY_FUNCTION(cmptType, diagTensorType, contractScalar) \ +UNARY_FUNCTION(cmptType, sphericalTensorType, contractScalar) \ +UNARY_FUNCTION(cmptType, vectorType, contractScalar) \ + \ +UNARY_FUNCTION(vectorType, tensorType, contractLinear) \ +UNARY_FUNCTION(vectorType, diagTensorType, contractLinear) \ +UNARY_FUNCTION(vectorType, sphericalTensorType, contractLinear) \ + \ +UNARY_FUNCTION(vectorType, cmptType, expandScalar) \ +UNARY_FUNCTION(tensorType, cmptType, expandScalar) \ +UNARY_FUNCTION(diagTensorType, cmptType, expandScalar) \ +UNARY_FUNCTION(sphericalTensorType, cmptType, expandScalar) \ + \ +UNARY_FUNCTION(tensorType, vectorType, expandLinear) \ +UNARY_FUNCTION(diagTensorType, vectorType, expandLinear) \ +UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear) + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +forAllVectorTensorNTypes(ExpandFieldFunctions) + +// template +// void contractScalar +// ( +// Field& res, +// const UList >& f +// ) +// { +// forAll (res, i) +// { +// contractScalar(res[i], f[i]); +// } +// } +// +// +// template +// void contractLinear +// ( +// Field >& res, +// const UList >& f +// ) +// { +// forAll (res, i) +// { +// contractLinear(res[i], f[i]); +// } +// } +// +// +// template +// void expandScalar +// ( +// Field >& res, +// const UList& f +// ) +// { +// forAll (res, i) +// { +// expandScalar(res[i], f[i]); +// } +// } +// +// +// template +// void expandScalar +// ( +// Field >& res, +// const UList& f +// ) +// { +// forAll (res, i) +// { +// expandScalar(res[i], f[i]); +// } +// } +// +// +// template +// void expandLinear +// ( +// Field >& res, +// const UList >& f +// ) +// { +// forAll (res, i) +// { +// expandLinear(res[i], f[i]); +// } +// } + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef UNARY_FUNCTION +#undef ExpandFieldFunctions + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.H b/src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.H new file mode 100644 index 000000000..abd8b22a4 --- /dev/null +++ b/src/VectorN/OpenFOAM/expandContract/ExpandTensorNField.H @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + Global functions for expansion and contraction of tensor field + to diagonal type + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved + +SourceFiles + ExpandTensorNField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef expandTensorNField_H +#define expandTensorNField_H + +#include "Field.H" +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define UNARY_FUNCTION(typeF1, typeF2, FUNC) \ +void FUNC(Field& f1, const UList& f2); \ +void FUNC(Field& f1, const tmp >& tf2); + + +#define ExpandFieldFunctions(tensorType, diagTensorType, sphericalTensorType, \ + vectorType, cmptType, args...) \ + \ +UNARY_FUNCTION(cmptType, tensorType, contractScalar) \ +UNARY_FUNCTION(cmptType, diagTensorType, contractScalar) \ +UNARY_FUNCTION(cmptType, sphericalTensorType, contractScalar) \ +UNARY_FUNCTION(cmptType, vectorType, contractScalar) \ + \ +UNARY_FUNCTION(vectorType, tensorType, contractLinear) \ +UNARY_FUNCTION(vectorType, diagTensorType, contractLinear) \ +UNARY_FUNCTION(vectorType, sphericalTensorType, contractLinear) \ + \ +UNARY_FUNCTION(vectorType, cmptType, expandScalar) \ +UNARY_FUNCTION(tensorType, cmptType, expandScalar) \ +UNARY_FUNCTION(diagTensorType, cmptType, expandScalar) \ +UNARY_FUNCTION(sphericalTensorType, cmptType, expandScalar) \ + \ +UNARY_FUNCTION(tensorType, vectorType, expandLinear) \ +UNARY_FUNCTION(diagTensorType, vectorType, expandLinear) \ +UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +forAllVectorTensorNTypes(ExpandFieldFunctions) + + +// template +// void contractScalar +// ( +// Field& res, +// const UList >& f +// ); +// +// template +// void contractScalar +// ( +// Field& res, +// const UList >& f +// ); +// +// template +// void contractScalar +// ( +// Field& res, +// const UList >& f +// ); +// +// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// +// template +// void contractLinear +// ( +// Field >& res, +// const UList >& f +// ); +// +// template +// void contractLinear +// ( +// Field >& res, +// const UList >& f +// ); +// +// template +// void contractLinear +// ( +// Field >& res, +// const UList >& f +// ); +// +// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// +// template +// void expandScalar +// ( +// Field >& res, +// const UList& f +// ); +// +// template +// void expandScalar +// ( +// Field >& res, +// const UList& f +// ); +// +// template +// void expandScalar +// ( +// Field >& res, +// const UList& f +// ); +// +// template +// void expandScalar +// ( +// Field >& res, +// const UList& f +// ); +// +// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// +// template +// void expandLinear +// ( +// Field >& res, +// const UList >& f +// ); +// +// template +// void expandLinear +// ( +// Field >& res, +// const UList >& f +// ); +// +// template +// void expandLinear +// ( +// Field >& res, +// const UList >& f +// ); + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef UNARY_FUNCTION +#undef ExpandFieldFunctions + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// #ifdef NoRepository +// # include "ExpandTensorNField.C" +// #endif + +// ************************************************************************* // + +#endif diff --git a/src/VectorN/OpenFOAM/expandContract/ExpandTensorNI.H b/src/VectorN/OpenFOAM/expandContract/ExpandTensorNI.H new file mode 100644 index 000000000..983a33ebe --- /dev/null +++ b/src/VectorN/OpenFOAM/expandContract/ExpandTensorNI.H @@ -0,0 +1,322 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + ExpandTensorN + +Description + +Author + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Return the Average of a vector of as a scalar +template +inline void contractScalar(Cmpt& result, const VectorN& t) +{ + result = pTraits::zero; + + for (int i = 0; i < TensorN::rowLength; i++) + { + result += t[i]; + } + +//- Modified 2009/11/3 by I. Clifford + result *= 1.0/VectorN::nComponents; +} + + +//- Return the Average of a vector of as a scalar +template +inline Cmpt contractScalar(const VectorN& t) +{ + Cmpt result; + contractScalar(result, t); + return result; +} + + +//- Return the diagonal of a TensorN as a scalar +template +inline void contractScalar(Cmpt& result, const TensorN& t) +{ + result = pTraits::zero; + + int j=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result += t[j]; + j += TensorN::rowLength+1; + } + +//- Modified 2009/11/3 by I. Clifford + result *= 1.0/TensorN::rowLength; +} + + +//- Return the diagonal of a TensorN as a scalar +template +inline Cmpt contractScalar(const TensorN& t) +{ + Cmpt result; + contractScalar(result, t); + return result; +} + + +//- Return the diagonal of a DiagTensorN as a scalar +template +inline void contractScalar(Cmpt& result, const DiagTensorN& t) +{ + result = pTraits::zero; + + for (int i = 0; i < DiagTensorN::rowLength; i++) + { + result += t[i]; + } + + result *= 1.0/TensorN::rowLength; +} + + +//- Return the diagonal of a DiagTensorN as a scalar +template +inline Cmpt contractScalar(const DiagTensorN& t) +{ + Cmpt result; + contractScalar(result, t); + return result; +} + + +//- Return the diagonal of a SphericalTensorN as a scalar +template +inline void contractScalar(Cmpt& result, const SphericalTensorN& t) +{ + result = t[0]; +} + + +//- Return the diagonal of a SphericalTensorN as a scalar +template +inline Cmpt contractScalar(const SphericalTensorN& t) +{ + Cmpt result; + contractScalar(result, t); + return result; +} + + +//- Return the diagonal of a TensorN as a vector +template +inline void contractLinear +( + VectorN& result, + const TensorN& t +) +{ + int j=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result[i] = t[j]; + j += TensorN::rowLength+1; + } +} + + +//- Return the diagonal of a TensorN as a vector +template +inline VectorN contractLinear(const TensorN& t) +{ + VectorN result; + contractLinear(result, t); + return result; +} + + +//- Return the diagonal of a DiagTensorN as a vector +template +inline void contractLinear +( + VectorN& result, + const DiagTensorN& t +) +{ + for (int i = 0; i < DiagTensorN::rowLength; i++) + { + result[i] = t[i]; + } +} + + +//- Return the diagonal of a DiagTensorN as a vector +template +inline VectorN contractLinear(const DiagTensorN& t) +{ + VectorN result; + contractLinear(result, t); + return result; +} + + +//- Return the diagonal of a SphericalTensorN as a vector +template +inline void contractLinear +( + VectorN& result, + const SphericalTensorN& t +) +{ + for (int i = 0; i < SphericalTensorN::rowLength; i++) + { + result[i] = t[0]; + } +} + + +//- Return the diagonal of a SphericalTensorN as a vector +template +inline VectorN contractLinear +( + const SphericalTensorN& t +) +{ + VectorN result; + contractLinear(result, t); + return result; +} + + +//- Return the VectorN given a scalar +template +inline void expandScalar(VectorN& result, const Cmpt& v) +{ + for (int i = 0; i < VectorN::nComponents; i++) + { + result[i] = v; + } +} + + +//- Return the TensorN given a scalar +template +inline void expandScalar(TensorN& result, const Cmpt& v) +{ + result = TensorN::zero; + + int j =0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result[j] = v; + j += TensorN::rowLength+1; + } +} + + +//- Return the DiagTensorN given a scalar +template +inline void expandScalar(DiagTensorN& result, const Cmpt& v) +{ + for (int i = 0; i < DiagTensorN::rowLength; i++) + { + result[i] = v; + } +} + + +//- Return the SphericalTensorN given a scalar +template +inline void expandScalar(SphericalTensorN& result, const Cmpt& v) +{ + result[0] = v; +} + + +//- Return the TensorN given a diagonal vectorN +template +inline void expandLinear +( + TensorN& result, + const VectorN& v +) +{ + result = TensorN::zero; + + int j=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result[j] = v[i]; + j += TensorN::rowLength+1; + } +} + +//- Return the DiagTensorN given a diagonal vectorN +template +inline void expandLinear +( + DiagTensorN& result, + const VectorN& v +) +{ + for (int i = 0; i < DiagTensorN::rowLength; i++) + { + result[i] = v[i]; + } +} + + +//- Return the SphericalTensorN given a diagonal vectorN +template +inline void expandLinear +( + SphericalTensorN& result, + const VectorN& v +) +{ + result[0] = pTraits::zero; + + for (int i = 0; i < DiagTensorN::rowLength; i++) + { + result[0] += v[i]; + } + + result[0] *= 1.0/DiagTensorN::rowLength; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/primitives/DiagTensorN.H b/src/VectorN/OpenFOAM/primitives/DiagTensorN.H new file mode 100644 index 000000000..2f5eb6c17 --- /dev/null +++ b/src/VectorN/OpenFOAM/primitives/DiagTensorN.H @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + DiagTensorN + +Description + Templated NXN DiagTensor derived from VectorSpace adding construction from + N components, and the inner-product (dot-product) and outer-product operators. + +SourceFiles + DiagTensorNI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef DiagTensorN_H +#define DiagTensorN_H + +#include "VectorN.H" +#include "SphericalTensorN.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class DiagTensor Declaration +\*---------------------------------------------------------------------------*/ + +template +class DiagTensorN +: + public VectorSpace, Cmpt, length> +{ + +public: + + // Member constants + + enum + { + rank = 2, // Rank of DiagTensor is 2 + rowLength = length + }; + + + // Static data members + + static const char* const typeName; + static const char* componentNames[]; + static const DiagTensorN zero; + static const DiagTensorN one; + static const DiagTensorN I; + + + // Constructors + + //- Construct null + inline DiagTensorN(); + + //- Construct given VectorSpace + inline DiagTensorN(const VectorSpace, Cmpt, length>&); + + //- Construct from Istream + inline DiagTensorN(Istream&); + + //- Construct given component value. Special use only! + explicit inline DiagTensorN(const Cmpt& tx); + + + // Member Functions + + //- Diagonal + inline DiagTensorN diag() const; + + //- Transpose + inline DiagTensorN T() const; + + // Member Operators + + //- Assign to a SphericalTensorN + inline void operator=(const SphericalTensorN&); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Include inline implementations +#include "DiagTensorNI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/primitives/DiagTensorNI.H b/src/VectorN/OpenFOAM/primitives/DiagTensorNI.H new file mode 100644 index 000000000..d784a10a3 --- /dev/null +++ b/src/VectorN/OpenFOAM/primitives/DiagTensorNI.H @@ -0,0 +1,409 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +const char* const DiagTensorN::typeName = + ("diagTensor" + name(length)).c_str(); + +template +const DiagTensorN DiagTensorN::zero(0); + +template +const DiagTensorN DiagTensorN::one(1); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct null +template +inline DiagTensorN::DiagTensorN() +{} + + +// Construct given VectorSpace +template +inline DiagTensorN::DiagTensorN +( + const VectorSpace, Cmpt, length>& vs +) +: + VectorSpace, Cmpt, length>(vs) +{} + + +//- Construct from component +template +inline DiagTensorN::DiagTensorN(const Cmpt& tx) +{ + VectorSpaceOps::nComponents,0>::eqOpS(*this, tx, eqOp()); +} + + +// Construct from Istream +template +inline DiagTensorN::DiagTensorN(Istream& is) +: + VectorSpace, Cmpt, length>(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +//- Return diagonal tensor diagonal +template +inline DiagTensorN DiagTensorN::diag() const +{ + return *this; +} + +//- Return diagonal tensor transpose +template +inline DiagTensorN DiagTensorN::T() const +{ + return *this; +} + + +//- Assign to a SphericalTensorN +template +inline void DiagTensorN::operator=(const SphericalTensorN& st) +{ + const Cmpt& s = st.v_[0]; + VectorSpaceOps::nComponents,0>::eqOpS(*this, s, eqOp()); +} + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +//- Addition of DiagTensorN and DiagTensorN +template +inline DiagTensorN +operator+(const DiagTensorN& dt1, const DiagTensorN& dt2) +{ + DiagTensorN res; + VectorSpaceOps::nComponents,0>::op(res, dt1, dt2, plusOp()); + return res; +} + + +//- Addition of DiagTensorN and SphericalTensorN +template +inline DiagTensorN +operator+(const DiagTensorN& dt1, const SphericalTensorN& st2) +{ + const Cmpt& s = st2.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opVS(res, dt1, s, plusOp()); + return res; +} + + +//- Addition of SphericalTensorN and DiagTensorN +template +inline DiagTensorN +operator+(const SphericalTensorN& st1, const DiagTensorN& dt2) +{ + const Cmpt& s = st1.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opSV(res, s, dt2, plusOp()); + return res; +} + + +//- Subtraction of DiagTensorN and DiagTensorN +template +inline DiagTensorN +operator-(const DiagTensorN& dt1, const DiagTensorN& dt2) +{ + DiagTensorN res; + VectorSpaceOps::nComponents,0>::op(res, dt1, dt2, minusOp()); + return res; +} + + +//- Subtraction of DiagTensorN and SphericalTensorN +template +inline DiagTensorN +operator-(const DiagTensorN& dt1, const SphericalTensorN& st2) +{ + const Cmpt& s = st2.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opVS(res, dt1, s, minusOp()); + return res; +} + + +//- Subtraction of SphericalTensorN and DiagTensorN +template +inline DiagTensorN +operator-(const SphericalTensorN& st1, const DiagTensorN& dt2) +{ + const Cmpt& s = st1.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opSV(res, s, dt2, minusOp()); + return res; +} + + +//- Inner-product between a diagonal tensor and a diagonal tensor +template +inline typename +innerProduct, DiagTensorN >::type +operator&(const DiagTensorN& dt1, const DiagTensorN& dt2) +{ + DiagTensorN res; + VectorSpaceOps::nComponents,0>::op(res, dt1, dt2, multiplyOp()); + return res; +} + + +//- Inner-product between spherical tensor and diagonal tensor +template +inline typename +innerProduct, DiagTensorN >::type +operator&(const SphericalTensorN& st1, const DiagTensorN& dt2) +{ + const Cmpt& s = st1.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opSV(res, s, dt2, multiplyOp()); + return res; +} + + +//- Inner-product between diagonal tensor and spherical tensor +template +inline typename +innerProduct, SphericalTensorN >::type +operator&(const DiagTensorN& dt1, const SphericalTensorN& st2) +{ + const Cmpt& s = st2.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opVS(res, dt1, s, multiplyOp()); + return res; +} + + +//- Inner-product between a diagonal tensor and a vector +template +inline typename +innerProduct, VectorN >::type +operator&(const DiagTensorN& dt, const VectorN& v) +{ + VectorN res; + VectorSpaceOps::nComponents,0>::opVV(res, dt, v, multiplyOp()); + return res; +} + + + +//- Inner-product between a vector and a tensor +template +inline typename +innerProduct, DiagTensorN >::type +operator&(const VectorN& v, const DiagTensorN& dt) +{ + VectorN res; + VectorSpaceOps::nComponents,0>::opVV(res, v, dt, multiplyOp()); + return res; +} + + +//- Division of a scalar by a diagonalTensor +template +inline DiagTensorN +operator/(const scalar s, const DiagTensorN& dt) +{ + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opSV(res, s, dt, divideOp3()); + return res; +} + + +//- Inner Product of a VectorN by an inverse diagonalTensor +template +inline VectorN +operator/(const VectorN& v, const DiagTensorN& dt) +{ + VectorN res(v); + VectorSpaceOps::nComponents,0>::eqOp(res, dt, divideEqOp()); + return res; +} + + +//- Inner Product of a DiagTensorN and an inverse DiagTensorN +template +inline DiagTensorN +operator/(const DiagTensorN& dt1, const DiagTensorN& dt2) +{ + DiagTensorN res; + VectorSpaceOps::nComponents,0>::op(res, dt1, dt2, divideOp()); + return res; +} + + +//- Inner Product of a SphericalTensorN and an inverse DiagTensorN +template +inline DiagTensorN +operator/(const SphericalTensorN& st1, const DiagTensorN& dt2) +{ + const Cmpt& s = st1.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opSV(res, s, dt2, divideOp()); + return res; +} + + +//- Inner Product of a DiagTensorN and an inverse SphericalTensorN +template +inline DiagTensorN +operator/(const DiagTensorN& dt1, const SphericalTensorN& st2) +{ + const Cmpt& s = st2.v_[0]; + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opVS(res, dt1, s, divideOp()); + return res; +} + + +//- Return the inverse of a diagonal tensor +template +inline DiagTensorN inv(const DiagTensorN& dt) +{ + DiagTensorN res; + VectorSpaceOps::nComponents,0>::opSV(res, 1.0, dt, divideOp()); + return res; +} + + +//- Return tensor diagonal +template +inline DiagTensorN diag(const DiagTensorN& dt) +{ + return dt; +} + + +//- Return the component sum +// template +// inline Cmpt sum(const DiagTensorN& dt) +// { +// Cmpt result=Cmpt::zero; +// for(register label i=0; i::nComponents; i++) +// { +// result += dt[i]; +// } +// return result; +// } + + +//- Transform the spherical tensor +//- The components are assumed to be individual scalars +//- i.e. transform has no effect +template +inline DiagTensorN transform +( + const tensor& tt, + const DiagTensorN& v +) +{ + return v; +} + + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +template +class outerProduct, Cmpt> +{ +public: + + typedef DiagTensorN type; +}; + +template +class outerProduct > +{ +public: + + typedef DiagTensorN type; +}; + + +template +class innerProduct, DiagTensorN > +{ +public: + + typedef DiagTensorN type; +}; + + +template +class innerProduct, DiagTensorN > +{ +public: + + typedef DiagTensorN type; +}; + + +template +class innerProduct, SphericalTensorN > +{ +public: + + typedef DiagTensorN type; +}; + + +template +class innerProduct, DiagTensorN > +{ +public: + + typedef VectorN type; +}; + + +template +class innerProduct, VectorN > +{ +public: + + typedef VectorN type; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/primitives/SphericalTensorN.H b/src/VectorN/OpenFOAM/primitives/SphericalTensorN.H new file mode 100644 index 000000000..40655026c --- /dev/null +++ b/src/VectorN/OpenFOAM/primitives/SphericalTensorN.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + SphericalTensorN + +Description + Templated NXN SphericalTensor derived from VectorSpace adding construction from + N components, and the inner-product (dot-product) and outer-product operators. + +SourceFiles + SphericalTensorNI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef SphericalTensorN_H +#define SphericalTensorN_H + +#include "VectorN.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class DiagTensor Declaration +\*---------------------------------------------------------------------------*/ + +template +class SphericalTensorN +: + public VectorSpace, Cmpt, 1> +{ + +public: + + // Member constants + + enum + { + rank = 2, // Rank of DiagTensor is 2 + rowLength = length + }; + + + // Static data members + + static const char* const typeName; + static const char* componentNames[]; + static const SphericalTensorN zero; + static const SphericalTensorN one; + static const SphericalTensorN I; + + + // Constructors + + //- Construct null + inline SphericalTensorN(); + + //- Construct given VectorSpace + inline SphericalTensorN(const VectorSpace, Cmpt, 1>&); + + //- Construct from Istream + inline SphericalTensorN(Istream&); + + //- Construct given component value. Special use only! + explicit inline SphericalTensorN(const Cmpt& tx); + + + // Member Functions + + //- Diagonal + inline SphericalTensorN diag() const; + + //- Transpose + inline SphericalTensorN T() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Include inline implementations +#include "SphericalTensorNI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/primitives/SphericalTensorNI.H b/src/VectorN/OpenFOAM/primitives/SphericalTensorNI.H new file mode 100644 index 000000000..429cbdb6d --- /dev/null +++ b/src/VectorN/OpenFOAM/primitives/SphericalTensorNI.H @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +const char* const SphericalTensorN::typeName = + ("sphericalTensor" + name(length)).c_str(); + +template +const SphericalTensorN SphericalTensorN::zero(0); + +template +const SphericalTensorN SphericalTensorN::one(1); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct null +template +inline SphericalTensorN::SphericalTensorN() +{} + + +// Construct given VectorSpace +template +inline SphericalTensorN::SphericalTensorN +( + const VectorSpace, Cmpt, 1>& vs +) +: + VectorSpace, Cmpt, 1>(vs) +{} + + +//- Construct from component +template +inline SphericalTensorN::SphericalTensorN(const Cmpt& tx) +{ + this->v_[0] = tx; +} + + +// Construct from Istream +template +inline SphericalTensorN::SphericalTensorN(Istream& is) +: + VectorSpace, Cmpt, 1>(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +//- Return diagonal tensor diagonal +template +inline SphericalTensorN SphericalTensorN::diag() const +{ + return *this; +} + +//- Return spherical tensor transpose +template +inline SphericalTensorN SphericalTensorN::T() const +{ + return *this; +} + + +//- Transform the spherical tensor +//- The components are assumed to be individual scalars +//- i.e. transform has no effect +template +inline SphericalTensorN transform +( + const tensor& tt, + const SphericalTensorN& v +) +{ + return v; +} + + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + + +//- Addition of SphericalTensorN and SphericalTensorN +template +inline SphericalTensorN +operator+(const SphericalTensorN& st1, const SphericalTensorN& st2) +{ + return SphericalTensorN(st1.v_[0] + st2.v_[0]); +} + + +//- Subtraction of SphericalTensorN and SphericalTensorN +template +inline SphericalTensorN +operator-(const SphericalTensorN& st1, const SphericalTensorN& st2) +{ + return SphericalTensorN(st1.v_[0] - st2.v_[0]); +} + + +//- Inner-product between spherical tensor and spherical tensor +template +inline typename +innerProduct, SphericalTensorN >::type +operator&(const SphericalTensorN& st1, const SphericalTensorN& st2) +{ + return SphericalTensorN(st1.v_[0]*st2.v_[0]); +} + + +//- Inner-product between a spherical tensor and a vector +template +inline typename +innerProduct, VectorN >::type +operator&(const SphericalTensorN& st, const VectorN& v) +{ + const Cmpt& s = st.v_[0]; + VectorN res; + VectorSpaceOps::nComponents,0>::opSV(res, s, v, multiplyOp()); + return res; +} + + +//- Inner-product between a vector and a spherical tensor +template +inline typename +innerProduct, SphericalTensorN >::type +operator&(const VectorN& v, const SphericalTensorN& st) +{ + const Cmpt& s = st.v_[0]; + VectorN res; + VectorSpaceOps::nComponents,0>::opVS(res, v, s, multiplyOp()); + return res; +} + + +//- Product of a scalar and a spherical tensor +template +inline SphericalTensorN +operator*(const scalar s, const SphericalTensorN& st) +{ + return SphericalTensorN(s*st.v_[0]); +} + + +//- Division of a scalar by a spherical tensor +template +inline SphericalTensorN +operator/(const scalar s, const SphericalTensorN& st) +{ + return SphericalTensorN(s/st.v_[0]); +} + + +//- Inner Product of a VectorN by an inverse SphericalTensorN +template +inline VectorN +operator/(const VectorN& v, const SphericalTensorN& st) +{ + return v/st.v_[0]; +} + + +//- Inner Product of a SphericalTensorN and an inverse SphericalTensorN +template +inline SphericalTensorN +operator/(const SphericalTensorN& st1, const SphericalTensorN& st2) +{ + return SphericalTensorN(st1.v_[0]/st2.v_[0]); +} + + +//- Return the inverse of a spherical tensor +template +inline SphericalTensorN inv(const SphericalTensorN& st) +{ + return SphericalTensorN(pTraits::one/st.v_[0]); +} + + +//- Return tensor diagonal +template +inline SphericalTensorN diag(const SphericalTensorN& st) +{ + return st; +} + +//- Return the component sum +template +inline Cmpt sum(const SphericalTensorN& st) +{ + return SphericalTensorN::rowLength*st.v_[0]; +} + + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +template +class outerProduct > +{ +public: + + typedef SphericalTensorN type; +}; + +template +class outerProduct, Cmpt> +{ +public: + + typedef SphericalTensorN type; +}; + + +template +class innerProduct, VectorN > +{ +public: + + typedef VectorN type; +}; + +template +class innerProduct, SphericalTensorN > +{ +public: + + typedef VectorN type; +}; + +template +class innerProduct, SphericalTensorN > +{ +public: + + typedef SphericalTensorN type; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/primitives/TensorN.H b/src/VectorN/OpenFOAM/primitives/TensorN.H new file mode 100644 index 000000000..d9c87422f --- /dev/null +++ b/src/VectorN/OpenFOAM/primitives/TensorN.H @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + TensorN + +Description + +SourceFiles + TensorNI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef TensorN_H +#define TensorN_H + +#include "VectorN.H" +#include "SphericalTensorN.H" +#include "DiagTensorN.H" + +// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // + +template +class DiagTensorN; + +template +class SphericalTensorN; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class TensorN Declaration +\*---------------------------------------------------------------------------*/ + +template +class TensorN +: + public VectorSpace, Cmpt, length*length> +{ + +public: + + // Member constants + + enum + { + rank = 2, // Rank of TensorN is 2 + rowLength = length // Number of components in a row + }; + + + // Static data members + + static const char* const typeName; + + static const TensorN zero; + static const TensorN one; + + + // Constructors + + //- Construct null + inline TensorN(); + + //- Construct given VectorSpace + inline TensorN + ( + const VectorSpace, Cmpt, length*length>& + ); + + //- Construct given component value. Special use only! + explicit inline TensorN(const Cmpt& tx); + + //- Construct from Istream + TensorN(Istream&); + + + // Member Functions + + //- Return (i, j) component + inline const Cmpt& operator() + ( + const direction i, + const direction j + ) const; + + //- Return access to (i, j) component + inline Cmpt& operator() + ( + const direction i, + const direction j + ); + + //- Diagonal + inline DiagTensorN diag() const; + + //- Transpose + inline TensorN T() const; + + //- Negative sum the vertical off-diagonal components + inline TensorN negSumDiag() const; + + // Member Operators + + //- Assign to a SphericalTensorN + inline void operator=(const SphericalTensorN&); + + //- Assign to a DiagTensorN + inline void operator=(const DiagTensorN&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Include inline implementations +#include "TensorNI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/VectorN/OpenFOAM/primitives/TensorNI.H b/src/VectorN/OpenFOAM/primitives/TensorNI.H new file mode 100644 index 000000000..2c07d382c --- /dev/null +++ b/src/VectorN/OpenFOAM/primitives/TensorNI.H @@ -0,0 +1,985 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +const char* const TensorN::typeName = + ("tensor" + name(length)).c_str(); + +template +const TensorN TensorN::zero(0); + +template +const TensorN TensorN::one(1); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +//- Construct null +template +inline TensorN::TensorN() +{} + + +//- Construct given VectorSpace +template +inline TensorN::TensorN +( + const VectorSpace, Cmpt, length*length>& vs +) +: + VectorSpace, Cmpt, length*length>(vs) +{} + + +//- Construct from component +template +inline TensorN::TensorN(const Cmpt& tx) +{ + VectorSpaceOps::nComponents,0>::eqOpS(*this, tx, eqOp()); +} + + +//- Construct from Istream +template +inline TensorN::TensorN(Istream& is) +: + VectorSpace, Cmpt, length*length>(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +//- Return tensor transpose +template +inline TensorN TensorN::T() const +{ + TensorN transpose; + + int i = 0; + for (int row = 0; row < TensorN::rowLength; row++) + { + int j=row; + for (int col = 0; col < TensorN::rowLength; col++) + { + transpose.v_[i] = this->v_[j]; + i++; + j += TensorN::rowLength; + } + } + + return transpose; +} + +//- Return tensor diagonal +template +inline DiagTensorN TensorN::diag() const +{ + DiagTensorN dt; + + int diagI=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + dt[i] = this->v_[diagI]; + diagI += TensorN::rowLength + 1; + } + + return dt; +} + +//- Negative sum the vertical off-diagonal components +template +inline TensorN TensorN::negSumDiag() const +{ + TensorN negsumdiag; + + // Zero main diagonal + int diagI=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + negsumdiag.v_[diagI] = 0.0; + diagI += TensorN::rowLength + 1; + } + + int k=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + diagI = 0; + for (int j = 0; j < TensorN::rowLength; j++) + { + if (k != diagI) + { + negsumdiag.v_[k] = this->v_[k]; + negsumdiag.v_[diagI] -= this->v_[k]; + } + k++; + diagI += TensorN::rowLength + 1; + } + } + + return negsumdiag; +} + +//- Assign to a SphericalTensorN +template +inline void TensorN::operator=(const SphericalTensorN& st) +{ + int diag=0; + for (int i = 0; i < TensorN::nComponents; i++) + { + if (i == diag) + { + this->v_[i] = st[0]; + diag += TensorN::rowLength + 1; + } + else + { + this->v_[i] = pTraits::zero; + } + } +} + + +//- Assign to a DiagTensorN +template +inline void TensorN::operator=(const DiagTensorN& dt) +{ + int diag=0; + int k=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + for (int j = 0; j < TensorN::rowLength; j++) + { + if (j == diag) + { + this->v_[k] = dt[i]; + } + else + { + this->v_[k] = pTraits::zero; + } + k++; + } + diag++; + } +} + + +//- Transform the tensor +//- The components are assumed to be individual scalars +//- i.e. transform has no effect +template +inline TensorN transform +( + const tensor& tt, + const TensorN& v +) +{ + return v; +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +inline const Cmpt& TensorN::operator() +( + const direction i, + const direction j +) const +{ + return this->operator[](i*TensorN::rowLength + j); +} + + +template +inline Cmpt& TensorN::operator() +( + const direction i, + const direction j +) +{ + return this->operator[](i*TensorN::rowLength + j); +} + + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +//- Inner-product between two tensors +template +inline typename +innerProduct, TensorN >::type +operator&(const TensorN& t1, const TensorN& t2) +{ + TensorN result(TensorN::zero); + + int i = 0; + int j = 0; + for (int row = 0; row < TensorN::rowLength; row++) + { + for (int col = 0; col < TensorN::rowLength; col++) + { + Cmpt& r = result.v_[i]; + int m = j; + int n = col; + + for (int row2=0; row2 < TensorN::rowLength; row2++) + { + r += t1.v_[m]*t2.v_[n]; + m++; + n += TensorN::rowLength; + } + i++; + } + j += TensorN::rowLength; + } + + return result; +} + +//- Inner-product between diagonal tensor and tensor +template +inline typename +innerProduct, TensorN >::type +operator&(const DiagTensorN& dt1, const TensorN& t2) +{ + TensorN result; + + int k=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + const Cmpt& xx = dt1.v_[i]; + + for (int j = 0; j < TensorN::rowLength; j++) + { + result.v_[k] = xx*t2.v_[k]; + k++; + } + } + + return result; +} + +//- Inner-product between tensor and diagonal tensor +template +inline typename +innerProduct, DiagTensorN >::type +operator&(const TensorN& t1, const DiagTensorN& dt2) +{ + TensorN result; + + int k=0; + for (int i = 0; i < TensorN::rowLength; i++) + { + for (int j = 0; j < TensorN::rowLength; j++) + { + result.v_[k] = t1.v_[k]*dt2.v_[j]; + k++; + } + } + + return result; +} + + +//- Inner-product between spherical tensor and tensor +template +inline typename +innerProduct, TensorN >::type +operator&(const SphericalTensorN& st1, const TensorN& t2) +{ + const Cmpt& s = st1.v_[0]; + TensorN res; + VectorSpaceOps::nComponents,0>::opSV(res, s, t2, multiplyOp()); + return res; +} + + +//- Inner-product between tensor and spherical tensor +template +inline typename +innerProduct, SphericalTensorN >::type +operator&(const TensorN& t1, const SphericalTensorN& st2) +{ + const Cmpt& s = st2.v_[0]; + TensorN res; + VectorSpaceOps::nComponents,0>::opVS(res, t1, s, multiplyOp()); + return res; +} + + +//- Inner-product between a tensor and a vector +template +inline typename +innerProduct, VectorN >::type +operator&(const TensorN& t, const VectorN& v) +{ + VectorN result(VectorN::zero); + + int i=0; + for (int row = 0; row < TensorN::rowLength; row++) + { + Cmpt& r = result.v_[row]; + + for (int col = 0; col < TensorN::rowLength; col++) + { + r += t.v_[i]*v.v_[col]; + i++; + } + } + + return result; +} + + +//- Inner-product between a vector and a tensor +template +inline typename +innerProduct, TensorN >::type +operator&(const VectorN& v, const TensorN& t) +{ + VectorN result(VectorN::zero); + + for (int col = 0; col < TensorN::rowLength; col++) + { + int j=col; + Cmpt& r = result.v_[col]; + + for (int row = 0; row < TensorN::rowLength; row++) + { + r += v.v_[row]*t.v_[j]; + j += TensorN::rowLength; + } + } + + return result; +} + + +//- Outer-product between two vectors +template +inline typename +outerProduct, VectorN >::type +operator*(const VectorN& v1, const VectorN& v2) +{ + TensorN result(TensorN::zero); + + int i=0; + for (int row = 0; row < TensorN::rowLength; row++) + { + for (int col = 0; col < TensorN::rowLength; col++) + { + result.v_[i] = v1.v_[row]*v2.v_[col]; + i++; + } + } + + return result; +} + + +//- Addition of TensorN and TensorN +template +inline TensorN +operator+(const TensorN& t1, const TensorN& t2) +{ + TensorN res; + VectorSpaceOps::nComponents,0>::op(res, t1, t2, plusOp()); + return res; +} + + +//- Addition of TensorN and DiagTensorN +template +inline TensorN +operator+(const TensorN& t1, const DiagTensorN& dt2) +{ + TensorN result(t1); + + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] += dt2.v_[i]; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Addition of DiagTensorN and TensorN +template +inline TensorN +operator+(const DiagTensorN& dt1, const TensorN& t2) +{ + TensorN result(t2); + + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] += dt1.v_[i]; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Addition of TensorN and SphericalTensorN +template +inline TensorN +operator+(const TensorN& t1, const SphericalTensorN& st2) +{ + TensorN result(t1); + + const Cmpt& s = st2.v_[0]; + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] += s; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Addition of SphericalTensorN and TensorN +template +inline TensorN +operator+(const SphericalTensorN& st1, const TensorN& t2) +{ + TensorN result(t2); + + const Cmpt& s = st1.v_[0]; + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] += s; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Subtraction of TensorN and TensorN +template +inline TensorN +operator-(const TensorN& t1, const TensorN& t2) +{ + TensorN res; + VectorSpaceOps::nComponents,0>::op(res, t1, t2, minusOp()); + return res; +} + + +//- Subtraction of TensorN and DiagTensorN +template +inline TensorN +operator-(const TensorN& t1, const DiagTensorN& dt2) +{ + TensorN result(t1); + + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] -= dt2.v_[i]; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Subtraction of DiagTensorN and TensorN +template +inline TensorN +operator-(const DiagTensorN& dt1, const TensorN& t2) +{ + TensorN result(-t2); + + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] += dt1.v_[i]; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Subtraction of TensorN and SphericalTensorN +template +inline TensorN +operator-(const TensorN& t1, const SphericalTensorN& st2) +{ + TensorN result(t1); + + const Cmpt& s = st2.v_[0]; + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] -= s; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Subtraction of SphericalTensorN and TensorN +template +inline TensorN +operator-(const SphericalTensorN& st1, const TensorN& t2) +{ + TensorN result(-t2); + + const Cmpt& s = st1.v_[0]; + int diag = 0; + for (int i = 0; i < TensorN::rowLength; i++) + { + result.v_[diag] += s; + diag += TensorN::rowLength + 1; + } + + return result; +} + + +//- Division of a scalar by a TensorN +template +inline TensorN +operator/(const scalar s, const TensorN& t) +{ + return s*inv(t); +} + +//- Inner Product of a VectorN by an inverse TensorN +template +inline VectorN +operator/(const VectorN& v, const TensorN& t) +{ + return v & inv(t); +} + +//- Inner Product of a TensorN by an inverse TensorN +template +inline TensorN +operator/(const TensorN& t1, const TensorN& t2) +{ + return t1 & inv(t2); +} + + +//- Inner Product of a DiagTensorN and an inverse TensorN +template +inline TensorN +operator/(const DiagTensorN& dt1, const TensorN& t2) +{ + return dt1 & inv(t2); +} + + +//- Inner Product of a TensorN and an inverse DiagTensorN +template +inline TensorN +operator/(const TensorN& t1, const DiagTensorN& dt2) +{ + return t1 & inv(dt2); +} + + +//- Inner Product of a SphericalTensorN and an inverse TensorN +template +inline TensorN +operator/(const SphericalTensorN& st1, const TensorN& t2) +{ + return st1.v_[0] * inv(t2); +} + + +//- Inner Product of a TensorN and an inverse SphericalTensorN +template +inline TensorN +operator/(const TensorN& t1, const SphericalTensorN& st2) +{ + TensorN result; + + const Cmpt& s = st2[0]; + for (int i = 0; i < TensorN::nComponents; i++) + { + result.v_[i] = t1.v_[i]/s; + } + + return result; +} + + +// UNOPTIMIZED VERSION +/* +//- Return the inverse of a tensor give the determinant +// Uses Gauss-Jordan Elimination with full pivoting +template +inline TensorN inv(const TensorN& t) +{ + TensorN result(t); + + label i, j, k, iRow=0, iCol=0; + Cmpt bigValue, temp, pivotInv; + + // Lists used for bookkeeping on the pivoting + List