View Issue Details

IDProjectCategoryView StatusLast Update
0004010OpenFOAMPatchpublic2023-08-19 09:12
Reporterhandrake0724 Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Product Versiondev 
Summary0004010: suggestion to cutTriTet template class
DescriptionIf I am not mistaken, areaIntegrateOp can only do area moment but do not second/product moment of area.

the constructor takes moment arm data in the form of triangular points and in the function call operator, it takes triangle data.
the moment arm is automatically calculated with the moment arm data take from the constructor.

I think in this form, it is not possible to provide x^2, yx as a moment arm for the calculation of second/product moment of area.

Instead, taking triangle data in the constructor and provide moment arm data in the function call operator could provide further functionalities including the original one.

if its usage in the OpenFOAM source code is using just triangle data by providing points on the triangle data, I think this change would not affect that much.

if it is possible, then areaIntegrateOp, areaMagIntegrateOp, and volumeIntegrateOp will have similar changes.

TagsNo tags attached.

Activities

handrake0724

2023-08-19 08:35

viewer  

patch.diff (3,031 bytes)   
diff --git a/src/meshTools/cutTriTet/cutTriTet.H b/src/meshTools/cutTriTet/cutTriTet.H
index 8d667c2f1a..6257b34f1f 100644
--- a/src/meshTools/cutTriTet/cutTriTet.H
+++ b/src/meshTools/cutTriTet/cutTriTet.H
@@ -285,9 +285,9 @@ public:
     // Constructors
 
         //- Construct from base
-        areaIntegrateOp(const FixedList<Type, 3>& x)
+        areaIntegrateOp(const FixedList<Type, 3>& tri)
         :
-            FixedList<Type, 3>(x)
+            FixedList<Type, 3>(tri)
         {}
 
 
@@ -300,11 +300,18 @@ public:
         }
 
         //- Operate on a triangle
-        result operator()(const FixedList<point, 3>& p) const
+        result operator()(const FixedList<point, 3>& x) const
+        {
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaOp()(tri)*(x[0] + x[1] + x[2])/3);
+        }
+
+        result operator()(const point& x) const
         {
-            const FixedList<Type, 3>& x = *this;
-            return result(areaOp()(p)*(x[0] + x[1] + x[2])/3);
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaOp()(tri)*x;
         }
+
 };
 
 
@@ -328,9 +335,9 @@ public:
     // Constructors
 
         //- Construct from base
-        areaMagIntegrateOp(const FixedList<Type, 3>& x)
+        areaMagIntegrateOp(const FixedList<Type, 3>& tri)
         :
-            FixedList<Type, 3>(x)
+            FixedList<Type, 3>(tri)
         {}
 
 
@@ -343,10 +350,16 @@ public:
         }
 
         //- Operate on a triangle
-        result operator()(const FixedList<point, 3>& p) const
+        result operator()(const FixedList<point, 3>& x) const
         {
-            const FixedList<Type, 3>& x = *this;
-            return result(areaMagOp()(p)*(x[0] + x[1] + x[2])/3);
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaMagOp()(tri)*(x[0] + x[1] + x[2])/3);
+        }
+
+        result operator()(const point& x) const
+        {
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaMagOp()(tri)*x;
         }
 };
 
@@ -371,9 +384,9 @@ public:
     // Constructors
 
         //- Construct from base
-        volumeIntegrateOp(const FixedList<Type, 4>& x)
+        volumeIntegrateOp(const FixedList<Type, 4>& tet)
         :
-            FixedList<Type, 4>(x)
+            FixedList<Type, 4>(tet)
         {}
 
 
@@ -386,10 +399,16 @@ public:
         }
 
         //- Operate on a tetrahedron
-        result operator()(const FixedList<point, 4>& p) const
+        result operator()(const FixedList<point, 4>& x) const
+        {
+            const FixedList<Type, 4>& tet = *this;
+            return result(volumeOp()(tet)*(x[0] + x[1] + x[2] + x[3])/4);
+        }
+
+        result operator()(const point& x) const
         {
-            const FixedList<Type, 4>& x = *this;
-            return result(volumeOp()(p)*(x[0] + x[1] + x[2] + x[3])/4);
+            const FixedList<Type, 4>& tet = *this;
+            return result(volumeOp()(tet)*x;
         }
 };
 
patch.diff (3,031 bytes)   

administrator

2023-08-19 09:12

administrator   ~0013104

Pending funding

Issue History

Date Modified Username Field Change
2023-08-19 08:35 handrake0724 New Issue
2023-08-19 08:35 handrake0724 File Added: patch.diff
2023-08-19 09:12 administrator Note Added: 0013104