[cig-commits] r4311 - in long/3D/Gale/trunk/src/StGermain: .
Discretisation/Geometry/src Discretisation/Geometry/tests
walter at geodynamics.org
walter at geodynamics.org
Thu Aug 17 17:16:28 PDT 2006
Author: walter
Date: 2006-08-17 17:16:27 -0700 (Thu, 17 Aug 2006)
New Revision: 4311
Modified:
long/3D/Gale/trunk/src/StGermain/
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.0of1.FullTensorMath.txt.expected
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.0of1.expected
long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.c
Log:
r2689 at earth: boo | 2006-08-17 17:14:10 -0700
r2643 at earth (orig r3724): KathleenHumble | 2006-07-27 21:04:46 -0700
Moved enumerated types and associated functions
for SymmetricTensor and TensorArray
from fullTensorMath to TensorMath.
patched tests as appropriate.
Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
- 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2688
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3723
+ 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2689
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3724
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.c 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.c 2006-08-18 00:16:27 UTC (rev 4311)
@@ -49,65 +49,8 @@
#define STG_TENSOR_ERROR 1.0e-05;
-/** Mappings from enumerated types to arrays
-This gives the user the option to use:
-References instead of enumerated types.
-TensorMapFT2D[0][0] = FT2D_00
-etc.
-*/
-const unsigned int TensorMapFT2D[2][2] = {{FT2D_00, FT2D_01},{FT2D_10, FT2D_11}};
-const unsigned int TensorMapST2D[2][2] = {{ST2D_00, ST2D_01},{ST2D_01, ST2D_11}};
-const unsigned int TensorMapFT3D[3][3] ={{FT3D_00, FT3D_01, FT3D_02},{FT3D_10, FT3D_11, FT3D_12},{FT3D_20, FT3D_21, FT3D_22}};
-const unsigned int TensorMapST3D[3][3] ={{ST3D_00, ST3D_01, ST3D_02},{ST3D_01, ST3D_11, ST3D_12},{ST3D_02, ST3D_12, ST3D_22}};
-/** This is a wrapper that converts a row/col index and a dimension
-into the correct number to reference the correct address of the value
-in the tensorArray function.
-*/
-int TensorArray_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim) {
- switch (dim) {
- case 3: {
- return TensorMapFT3D[ row_I ][ col_I ];
- }
- case 2: {
- return TensorMapFT2D[ row_I ][ col_I ];
- }
- default: {
- Stream* error = Journal_Register( ErrorStream_Type, "FullTensorMath" );
- Journal_Printf( error, "Cannot get tensor value for dimension %d in %s.\n", dim, __func__);
- Journal_Firewall( dim, Journal_Register( Error_Type, "FullTensorMath" ),
- "In func '%s' don't understand dim = %u\n", __func__, dim );
- }
-
- }
- return 0;
-}
-/** This is a wrapper that converts a row/col index and a dimension
-into the correct number to reference the correct address of the value
-in the symmetricTensor function.
-*/
-int SymmetricTensor_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim) {
- switch (dim) {
- case 3: {
- return TensorMapST3D[ row_I ][ col_I ];
- }
- case 2: {
- return TensorMapST2D[ row_I ][ col_I ];
- }
- default: {
- Stream* error = Journal_Register( ErrorStream_Type, "FullTensorMath" );
- Journal_Printf( error, "Cannot get tensor value for dimension %d in %s.\n", dim, __func__);
- Journal_Firewall( dim, Journal_Register( Error_Type, "FullTensorMath" ),
- "In func '%s' don't understand dim = %u\n", __func__, dim );
- }
-
- }
- return 0;
-}
-
-
-
/** Converts a symmetric tensor to a full tensor */
void StGermain_SymmetricTensor_ToTensorArray(SymmetricTensor symTensor, Dimension_Index dim, TensorArray fullTensor) {
switch (dim) {
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.h 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/FullTensorMath.h 2006-08-18 00:16:27 UTC (rev 4311)
@@ -54,7 +54,8 @@
XYZC vector;
Cmplx eigenvalue;
} ComplexEigenvector;
- /** TensorArray - Tensor (t_{ij}) here is defined in 2D as
+
+/** TensorArray - Tensor (t_{ij}) here is defined in 2D as
* t_{00} = tensor[0] t_{01} = tensor[1]
* t_{10} = tensor[2] t_{11} = tensor[3]
*
@@ -80,47 +81,8 @@
* tensor[5] = u_{12} = u_{21}
*/
-/** TensorIndex creates an enumerated type that can be used as
-Tensor indices for referencing:
-These indexes are defined as:
- ST ~ symmetric tensorArray
- FT ~ full tensorArray \\
- 2D ~ in 2 dimensions \\
- 3D ~ in 3 dimensions \\
-For example, tensorArray[FT2D_00] \\
-And the indexes follow this naming scheme (for full tensors):
-For 2D:
-\left{ a_{00}, a_{01} \\
- a_{10}, a_{11} \right}
-For 3D:
-\left{ a_{00}, a_{01}, a_{02} \\
- a_{10}, a_{11}, a_{12} \\
- a_{20}, a_{21}, a_{22} \right}
-
-Symmetric tensors only use the upper triangle indicee definitions.
-
-*/
- typedef enum TensorIndexST2D { ST2D_00=0, ST2D_11=1, ST2D_01=2 } TensorIndexST2D;
- /** See description for TensorIndexST2D */
- typedef enum TensorIndexFT2D { FT2D_00=0, FT2D_11=3, FT2D_01=1, FT2D_10=2 } TensorIndexFT2D;
- /** See description for TensorIndexST2D */
- typedef enum TensorIndexST3D { ST3D_00=0, ST3D_11=1, ST3D_22=2, ST3D_01=3, ST3D_02=4, ST3D_12=5} TensorIndexST3D;
- /** See description for TensorIndexST2D */
- typedef enum TensorIndexFT3D { FT3D_00=0, FT3D_11=4, FT3D_22=8, FT3D_01=1, FT3D_02=2, FT3D_10=3, FT3D_12=5, FT3D_20=6, FT3D_21=7} TensorIndexFT3D;
-
-/*Define mapping function for enumerated types to arrays */
-
-extern const unsigned int TensorMapFT2D[2][2];
-extern const unsigned int TensorMapST2D[2][2];
-extern const unsigned int TensorMapFT3D[3][3];
-extern const unsigned int TensorMapST3D[3][3];
-
-/*Define TensorArray mapping functions */
-
-int TensorArray_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim);
-int SymmetricTensor_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim);
-
+/* Define Tensor conversion function */
void StGermain_SymmetricTensor_ToTensorArray(SymmetricTensor symTensor, Dimension_Index dim, TensorArray fullTensor);
void StGermain_SymmetricTensor_ToTensorArray2D(SymmetricTensor symTensor, TensorArray fullTensor);
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.c 2006-08-18 00:16:27 UTC (rev 4311)
@@ -40,7 +40,63 @@
#include <math.h>
#include <string.h>
+/** Mappings from enumerated types to arrays
+This gives the user the option to use:
+References instead of enumerated types.
+TensorMapFT2D[0][0] = FT2D_00
+etc.
+*/
+const unsigned int TensorMapFT2D[2][2] = {{FT2D_00, FT2D_01},{FT2D_10, FT2D_11}};
+const unsigned int TensorMapST2D[2][2] = {{ST2D_00, ST2D_01},{ST2D_01, ST2D_11}};
+const unsigned int TensorMapFT3D[3][3] ={{FT3D_00, FT3D_01, FT3D_02},{FT3D_10, FT3D_11, FT3D_12},{FT3D_20, FT3D_21, FT3D_22}};
+const unsigned int TensorMapST3D[3][3] ={{ST3D_00, ST3D_01, ST3D_02},{ST3D_01, ST3D_11, ST3D_12},{ST3D_02, ST3D_12, ST3D_22}};
+/** This is a wrapper that converts a row/col index and a dimension
+into the correct number to reference the correct address of the value
+in the tensorArray function.
+*/
+int TensorArray_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim) {
+ switch (dim) {
+ case 3: {
+ return TensorMapFT3D[ row_I ][ col_I ];
+ }
+ case 2: {
+ return TensorMapFT2D[ row_I ][ col_I ];
+ }
+ default: {
+ Stream* error = Journal_Register( ErrorStream_Type, "FullTensorMath" );
+ Journal_Printf( error, "Cannot get tensor value for dimension %d in %s.\n", dim, __func__);
+ Journal_Firewall( dim, Journal_Register( Error_Type, "FullTensorMath" ),
+ "In func '%s' don't understand dim = %u\n", __func__, dim );
+ }
+
+ }
+ return 0;
+}
+
+/** This is a wrapper that converts a row/col index and a dimension
+into the correct number to reference the correct address of the value
+in the symmetricTensor function.
+*/
+int SymmetricTensor_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim) {
+ switch (dim) {
+ case 3: {
+ return TensorMapST3D[ row_I ][ col_I ];
+ }
+ case 2: {
+ return TensorMapST2D[ row_I ][ col_I ];
+ }
+ default: {
+ Stream* error = Journal_Register( ErrorStream_Type, "FullTensorMath" );
+ Journal_Printf( error, "Cannot get tensor value for dimension %d in %s.\n", dim, __func__);
+ Journal_Firewall( dim, Journal_Register( Error_Type, "FullTensorMath" ),
+ "In func '%s' don't understand dim = %u\n", __func__, dim );
+ }
+
+ }
+ return 0;
+}
+
void TensorArray_SetFromDoubleArray( TensorArray tensor, double** array, Dimension_Index dim ) {
Dimension_Index row_I, col_I;
@@ -847,12 +903,3 @@
"Function %s - doesn't understand dim = %u\n", __func__, dim );
}
}
-
-
-
-
-
-
-
-
-
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/src/TensorMath.h 2006-08-18 00:16:27 UTC (rev 4311)
@@ -70,6 +70,48 @@
double eigenvalue;
} Eigenvector;
+/** TensorIndex creates an enumerated type that can be used as
+Tensor indices for referencing:
+These indexes are defined as:
+ ST ~ symmetric tensorArray
+ FT ~ full tensorArray \\
+ 2D ~ in 2 dimensions \\
+ 3D ~ in 3 dimensions \\
+For example, tensorArray[FT2D_00] \\
+
+And the indexes follow this naming scheme (for full tensors):
+For 2D:
+\left{ a_{00}, a_{01} \\
+ a_{10}, a_{11} \right}
+For 3D:
+\left{ a_{00}, a_{01}, a_{02} \\
+ a_{10}, a_{11}, a_{12} \\
+ a_{20}, a_{21}, a_{22} \right}
+
+Symmetric tensors only use the upper triangle indicee definitions.
+
+*/
+ typedef enum TensorIndexST2D { ST2D_00=0, ST2D_11=1, ST2D_01=2 } TensorIndexST2D;
+ /** See description for TensorIndexST2D */
+ typedef enum TensorIndexFT2D { FT2D_00=0, FT2D_11=3, FT2D_01=1, FT2D_10=2 } TensorIndexFT2D;
+ /** See description for TensorIndexST2D */
+ typedef enum TensorIndexST3D { ST3D_00=0, ST3D_11=1, ST3D_22=2, ST3D_01=3, ST3D_02=4, ST3D_12=5} TensorIndexST3D;
+ /** See description for TensorIndexST2D */
+ typedef enum TensorIndexFT3D { FT3D_00=0, FT3D_11=4, FT3D_22=8, FT3D_01=1, FT3D_02=2, FT3D_10=3, FT3D_12=5, FT3D_20=6, FT3D_21=7} TensorIndexFT3D;
+
+/*Define mapping function for enumerated types to arrays */
+
+extern const unsigned int TensorMapFT2D[2][2];
+extern const unsigned int TensorMapST2D[2][2];
+extern const unsigned int TensorMapFT3D[3][3];
+extern const unsigned int TensorMapST3D[3][3];
+
+/*Define TensorArray mapping functions */
+
+int TensorArray_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim);
+int SymmetricTensor_TensorMap(Dimension_Index row_I, Dimension_Index col_I, Dimension_Index dim);
+
+
#define MAP_2D_TENSOR( ii, jj ) ( (jj) + 2*(ii) )
#define MAP_3D_TENSOR( ii, jj ) ( (jj) + 3*(ii) )
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.0of1.FullTensorMath.txt.expected
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.0of1.FullTensorMath.txt.expected 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.0of1.FullTensorMath.txt.expected 2006-08-18 00:16:27 UTC (rev 4311)
@@ -1,78 +1,4 @@
-/******************* Test 0 ************************/
-Test Mapping functions
-
-2-D
-The full tensor:
-tensorArray -
- 0.5 10
- 20 30
-The tensor Mapping using enumerated types:
-tensorArray[FT2D_00] = 0.5
-tensorArray[FT2D_01] = 10
- ---
-tensorArray[FT2D_10] = 20
-tensorArray[FT2D_11] = 30
-The symmetric tensor:
-symmTensor -
- 40 60
- 60 50
-The symmetric tensor Mapping using enumerated types:
-symmTensor[ST2D_00] = 40
-symmTensor[ST2D_01] = 60
- ---
-symmTensor[ST2D_11] = 50
-Test Mapping functions for Full Tensor using TensorArray_TensorMap
-
-(0,0): 0 = 0 (0,1): 1 = 1
-(1,0): 2 = 2 (1,1): 3 = 3
-Test Mapping functions for Symmetric Tensor using SymmetricTensor_TensorMap
-
-(0,0): 0 = 0 (0,1): 2 = 2
-(1,0): 2 = 2 (1,1): 1 = 1
-3-D
-The full tensor:
-tensorArray -
- 0 1 2
- 3 4 5
- 6 7 8
-The tensor Mapping using enumerated types:
-tensorArray[FT3D_00] = 0
-tensorArray[FT3D_01] = 1
-tensorArray[FT3D_02] = 2
- ---
-tensorArray[FT3D_10] = 3
-tensorArray[FT3D_11] = 4
-tensorArray[FT3D_12] = 5
- ---
-tensorArray[FT3D_20] = 6
-tensorArray[FT3D_21] = 7
-tensorArray[FT3D_22] = 8
-The symmetric tensor:
-symmTensor -
- 90 120 130
- 120 100 140
- 130 140 110
-The symmetric tensor Mapping using enumerated types:
-symmTensor[ST3D_00] = 90
-symmTensor[ST3D_01] = 120
-symmTensor[ST3D_02] = 130
- ---
-symmTensor[ST3D_11] = 100
-symmTensor[ST3D_12] = 140
- ---
-symmTensor[ST3D_22] = 110
-Test Mapping functions for Full Tensor using TensorArray_TensorMap
-
-(0,0): 0 = 0 (0,1): 1 = 1 (0,2): 2 = 2
-(1,0): 3 = 3 (1,1): 4 = 4 (1,2): 5 = 5
-(2,0): 6 = 6 (2,1): 7 = 7 (2,2): 8 = 8
-Test Mapping functions for Symmetric Tensor using SymmetricTensor_TensorMap
-
-(0,0): 0 = 0 (0,1): 3 = 3 (0,2): 4 = 4
-(1,0): 3 = 3 (1,1): 1 = 1 (1,2): 5 = 5
-(2,0): 4 = 4 (2,1): 5 = 5 (2,2): 2 = 2
-
/******************* Test Eigenvector 1 ************************/
Symmetric 2D Case from Kresig, p. 371f
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.c 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testFullTensorMath.c 2006-08-18 00:16:27 UTC (rev 4311)
@@ -89,126 +89,7 @@
tensor[2][0] = 2; tensor[2][1] = 2; tensor[2][2] = -7; tensor[2][3] = 2 ; tensor[2][4] = 3.1;
tensor[3][0] = -4; tensor[3][1] = 9; tensor[3][2] = 3 ; tensor[3][3] = 8 ; tensor[3][4] = 6;
tensor[4][0] = 3; tensor[4][1] = 1; tensor[4][2] = 9 ; tensor[4][3] = 2 ; tensor[4][4] = 12;
- /*Test mapping functions */
- Journal_Printf(stream, "\n/******************* Test 0 ************************/\n");
- Journal_Printf( stream, "Test Mapping functions\n\n");
- Journal_Printf( stream, "2-D\n");
- tensorArray[0] = 0.5;
- tensorArray[1] = 10;
- tensorArray[2] = 20;
- tensorArray[3] = 30;
- symmTensor[0] = 40;
- symmTensor[1] = 50;
- symmTensor[2] = 60;
- Journal_Printf( stream, "The full tensor:\n");
- Journal_PrintTensorArray( stream, tensorArray, 2 );
-
- Journal_Printf( stream, "The tensor Mapping using enumerated types:\n");
- Journal_PrintValue( stream, tensorArray[FT2D_00]);
- Journal_PrintValue( stream, tensorArray[FT2D_01]);
- Journal_Printf( stream, " ---\n");
- Journal_PrintValue( stream, tensorArray[FT2D_10]);
- Journal_PrintValue( stream, tensorArray[FT2D_11]);
-
- Journal_Printf( stream, "The symmetric tensor:\n");
- Journal_PrintSymmetricTensor( stream, symmTensor, 2 );
-
- Journal_Printf( stream, "The symmetric tensor Mapping using enumerated types:\n");
- Journal_PrintValue( stream, symmTensor[ST2D_00]);
- Journal_PrintValue( stream, symmTensor[ST2D_01]);
- Journal_Printf( stream, " ---\n");
- Journal_PrintValue( stream, symmTensor[ST2D_11]);
-
- Journal_Printf( stream, "Test Mapping functions for Full Tensor ");
- Journal_Printf( stream, "using TensorArray_TensorMap\n\n");
- Journal_Printf( stream, "(0,0): %d = %d ", FT2D_00, TensorArray_TensorMap(0,0,2));
- Journal_Printf( stream, "(0,1): %d = %d\n", FT2D_01, TensorArray_TensorMap(0,1,2));
- Journal_Printf( stream, "(1,0): %d = %d ", FT2D_10, TensorArray_TensorMap(1,0,2));
- Journal_Printf( stream, "(1,1): %d = %d\n", FT2D_11, TensorArray_TensorMap(1,1,2));
-
- Journal_Printf( stream, "Test Mapping functions for Symmetric Tensor ");
- Journal_Printf( stream, "using SymmetricTensor_TensorMap\n\n");
- Journal_Printf( stream, "(0,0): %d = %d ", ST2D_00, SymmetricTensor_TensorMap(0,0,2));
- Journal_Printf( stream, "(0,1): %d = %d\n", ST2D_01, SymmetricTensor_TensorMap(0,1,2));
- Journal_Printf( stream, "(1,0): %d = %d ", ST2D_01, SymmetricTensor_TensorMap(1,0,2));
- Journal_Printf( stream, "(1,1): %d = %d\n", ST2D_11, SymmetricTensor_TensorMap(1,1,2));
-
- Journal_Printf( stream, "3-D\n");
- tensorArray[0] = 0;
- tensorArray[1] = 1;
- tensorArray[2] = 2;
- tensorArray[3] = 3;
- tensorArray[4] = 4;
- tensorArray[5] = 5;
- tensorArray[6] = 6;
- tensorArray[7] = 7;
- tensorArray[8] = 8;
-
- symmTensor[0] = 90;
- symmTensor[1] = 100;
- symmTensor[2] = 110;
- symmTensor[3] = 120;
- symmTensor[4] = 130;
- symmTensor[5] = 140;
-
- Journal_Printf( stream, "The full tensor:\n");
- Journal_PrintTensorArray( stream, tensorArray, 3 );
-
- Journal_Printf( stream, "The tensor Mapping using enumerated types:\n");
- Journal_PrintValue( stream, tensorArray[FT3D_00]);
- Journal_PrintValue( stream, tensorArray[FT3D_01]);
- Journal_PrintValue( stream, tensorArray[FT3D_02]);
- Journal_Printf( stream, " ---\n");
- Journal_PrintValue( stream, tensorArray[FT3D_10]);
- Journal_PrintValue( stream, tensorArray[FT3D_11]);
- Journal_PrintValue( stream, tensorArray[FT3D_12]);
- Journal_Printf( stream, " ---\n");
- Journal_PrintValue( stream, tensorArray[FT3D_20]);
- Journal_PrintValue( stream, tensorArray[FT3D_21]);
- Journal_PrintValue( stream, tensorArray[FT3D_22]);
-
- Journal_Printf( stream, "The symmetric tensor:\n");
- Journal_PrintSymmetricTensor( stream, symmTensor, 3 );
-
- Journal_Printf( stream, "The symmetric tensor Mapping using enumerated types:\n");
- Journal_PrintValue( stream, symmTensor[ST3D_00]);
- Journal_PrintValue( stream, symmTensor[ST3D_01]);
- Journal_PrintValue( stream, symmTensor[ST3D_02]);
- Journal_Printf( stream, " ---\n");
- Journal_PrintValue( stream, symmTensor[ST3D_11]);
- Journal_PrintValue( stream, symmTensor[ST3D_12]);
- Journal_Printf( stream, " ---\n");
- Journal_PrintValue( stream, symmTensor[ST3D_22]);
-
- Journal_Printf( stream, "Test Mapping functions for Full Tensor ");
- Journal_Printf( stream, "using TensorArray_TensorMap\n\n");
- Journal_Printf( stream, "(0,0): %d = %d ", FT3D_00, TensorArray_TensorMap(0,0,3));
- Journal_Printf( stream, "(0,1): %d = %d ", FT3D_01, TensorArray_TensorMap(0,1,3));
- Journal_Printf( stream, "(0,2): %d = %d\n", FT3D_02, TensorArray_TensorMap(0,2,3));
-
- Journal_Printf( stream, "(1,0): %d = %d ", FT3D_10, TensorArray_TensorMap(1,0,3));
- Journal_Printf( stream, "(1,1): %d = %d ", FT3D_11, TensorArray_TensorMap(1,1,3));
- Journal_Printf( stream, "(1,2): %d = %d\n", FT3D_12, TensorArray_TensorMap(1,2,3));
-
- Journal_Printf( stream, "(2,0): %d = %d ", FT3D_20, TensorArray_TensorMap(2,0,3));
- Journal_Printf( stream, "(2,1): %d = %d ", FT3D_21, TensorArray_TensorMap(2,1,3));
- Journal_Printf( stream, "(2,2): %d = %d\n", FT3D_22, TensorArray_TensorMap(2,2,3));
-
- Journal_Printf( stream, "Test Mapping functions for Symmetric Tensor ");
- Journal_Printf( stream, "using SymmetricTensor_TensorMap\n\n");
- Journal_Printf( stream, "(0,0): %d = %d ", ST3D_00, SymmetricTensor_TensorMap(0,0,3));
- Journal_Printf( stream, "(0,1): %d = %d ", ST3D_01, SymmetricTensor_TensorMap(0,1,3));
- Journal_Printf( stream, "(0,2): %d = %d\n", ST3D_02, SymmetricTensor_TensorMap(0,2,3));
-
- Journal_Printf( stream, "(1,0): %d = %d ", ST3D_01, SymmetricTensor_TensorMap(1,0,3));
- Journal_Printf( stream, "(1,1): %d = %d ", ST3D_11, SymmetricTensor_TensorMap(1,1,3));
- Journal_Printf( stream, "(1,2): %d = %d\n", ST3D_12, SymmetricTensor_TensorMap(1,2,3));
-
- Journal_Printf( stream, "(2,0): %d = %d ", ST3D_02, SymmetricTensor_TensorMap(2,0,3));
- Journal_Printf( stream, "(2,1): %d = %d ", ST3D_12, SymmetricTensor_TensorMap(2,1,3));
- Journal_Printf( stream, "(2,2): %d = %d\n", ST3D_22, SymmetricTensor_TensorMap(2,2,3));
-
Journal_Printf(stream, "\n/******************* Test Eigenvector 1 ************************/\n");
Journal_Printf( stream, "Symmetric 2D Case from Kresig, p. 371f\n\n");
tensorArray[FT2D_00] = -5;
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.0of1.expected
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.0of1.expected 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.0of1.expected 2006-08-18 00:16:27 UTC (rev 4311)
@@ -1,4 +1,4 @@
-StGermain Framework. Copyright (C) 2003-2005 VPAC.
+StGermain Framework revision 3716. Copyright (C) 2003-2005 VPAC.
****************************************
Number of unique components of symmetric tensor of dimension 2 is 3
@@ -103,6 +103,80 @@
Found root -5.0000: Passed.
Found root -2.0000: Passed.
+/****************************************/
+Test Mapping functions
+
+2-D
+The full tensor:
+tensorArray -
+ 0.5 10
+ 20 30
+The tensor Mapping using enumerated types:
+tensorArray[FT2D_00] = 0.5
+tensorArray[FT2D_01] = 10
+ ---
+tensorArray[FT2D_10] = 20
+tensorArray[FT2D_11] = 30
+The symmetric tensor:
+symmTensor -
+ 40 60
+ 60 50
+The symmetric tensor Mapping using enumerated types:
+symmTensor[ST2D_00] = 40
+symmTensor[ST2D_01] = 60
+ ---
+symmTensor[ST2D_11] = 50
+Test Mapping functions for Full Tensor using TensorArray_TensorMap
+
+(0,0): 0 = 0 (0,1): 1 = 1
+(1,0): 2 = 2 (1,1): 3 = 3
+Test Mapping functions for Symmetric Tensor using SymmetricTensor_TensorMap
+
+(0,0): 0 = 0 (0,1): 2 = 2
+(1,0): 2 = 2 (1,1): 1 = 1
+3-D
+The full tensor:
+tensorArray -
+ 0 1 2
+ 3 4 5
+ 6 7 8
+The tensor Mapping using enumerated types:
+tensorArray[FT3D_00] = 0
+tensorArray[FT3D_01] = 1
+tensorArray[FT3D_02] = 2
+ ---
+tensorArray[FT3D_10] = 3
+tensorArray[FT3D_11] = 4
+tensorArray[FT3D_12] = 5
+ ---
+tensorArray[FT3D_20] = 6
+tensorArray[FT3D_21] = 7
+tensorArray[FT3D_22] = 8
+The symmetric tensor:
+symmTensor -
+ 90 120 130
+ 120 100 140
+ 130 140 110
+The symmetric tensor Mapping using enumerated types:
+symmTensor[ST3D_00] = 90
+symmTensor[ST3D_01] = 120
+symmTensor[ST3D_02] = 130
+ ---
+symmTensor[ST3D_11] = 100
+symmTensor[ST3D_12] = 140
+ ---
+symmTensor[ST3D_22] = 110
+Test Mapping functions for Full Tensor using TensorArray_TensorMap
+
+(0,0): 0 = 0 (0,1): 1 = 1 (0,2): 2 = 2
+(1,0): 3 = 3 (1,1): 4 = 4 (1,2): 5 = 5
+(2,0): 6 = 6 (2,1): 7 = 7 (2,2): 8 = 8
+Test Mapping functions for Symmetric Tensor using SymmetricTensor_TensorMap
+
+(0,0): 0 = 0 (0,1): 3 = 3 (0,2): 4 = 4
+(1,0): 3 = 3 (1,1): 1 = 1 (1,2): 5 = 5
+(2,0): 4 = 4 (2,1): 5 = 5 (2,2): 2 = 2
+
/******************* Test Eigenvector 1 ************************/
2D Case from Kresig, p. 371f
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.c 2006-08-18 00:16:25 UTC (rev 4310)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Geometry/tests/testTensorMath.c 2006-08-18 00:16:27 UTC (rev 4311)
@@ -205,6 +205,126 @@
testCubic( 1.0, -4.0, 5.0, -2.0, stream );
testCubic( 1.0, 4.0, -11.0, -30.0, stream );
+ /*Test mapping functions */
+ Journal_Printf(stream, "\n/****************************************/\n");
+ Journal_Printf( stream, "Test Mapping functions\n\n");
+ Journal_Printf( stream, "2-D\n");
+ tensorArray[0] = 0.5;
+ tensorArray[1] = 10;
+ tensorArray[2] = 20;
+ tensorArray[3] = 30;
+ symmTensor[0] = 40;
+ symmTensor[1] = 50;
+ symmTensor[2] = 60;
+
+ Journal_Printf( stream, "The full tensor:\n");
+ Journal_PrintTensorArray( stream, tensorArray, 2 );
+
+ Journal_Printf( stream, "The tensor Mapping using enumerated types:\n");
+ Journal_PrintValue( stream, tensorArray[FT2D_00]);
+ Journal_PrintValue( stream, tensorArray[FT2D_01]);
+ Journal_Printf( stream, " ---\n");
+ Journal_PrintValue( stream, tensorArray[FT2D_10]);
+ Journal_PrintValue( stream, tensorArray[FT2D_11]);
+
+ Journal_Printf( stream, "The symmetric tensor:\n");
+ Journal_PrintSymmetricTensor( stream, symmTensor, 2 );
+
+ Journal_Printf( stream, "The symmetric tensor Mapping using enumerated types:\n");
+ Journal_PrintValue( stream, symmTensor[ST2D_00]);
+ Journal_PrintValue( stream, symmTensor[ST2D_01]);
+ Journal_Printf( stream, " ---\n");
+ Journal_PrintValue( stream, symmTensor[ST2D_11]);
+
+ Journal_Printf( stream, "Test Mapping functions for Full Tensor ");
+ Journal_Printf( stream, "using TensorArray_TensorMap\n\n");
+ Journal_Printf( stream, "(0,0): %d = %d ", FT2D_00, TensorArray_TensorMap(0,0,2));
+ Journal_Printf( stream, "(0,1): %d = %d\n", FT2D_01, TensorArray_TensorMap(0,1,2));
+ Journal_Printf( stream, "(1,0): %d = %d ", FT2D_10, TensorArray_TensorMap(1,0,2));
+ Journal_Printf( stream, "(1,1): %d = %d\n", FT2D_11, TensorArray_TensorMap(1,1,2));
+
+ Journal_Printf( stream, "Test Mapping functions for Symmetric Tensor ");
+ Journal_Printf( stream, "using SymmetricTensor_TensorMap\n\n");
+ Journal_Printf( stream, "(0,0): %d = %d ", ST2D_00, SymmetricTensor_TensorMap(0,0,2));
+ Journal_Printf( stream, "(0,1): %d = %d\n", ST2D_01, SymmetricTensor_TensorMap(0,1,2));
+ Journal_Printf( stream, "(1,0): %d = %d ", ST2D_01, SymmetricTensor_TensorMap(1,0,2));
+ Journal_Printf( stream, "(1,1): %d = %d\n", ST2D_11, SymmetricTensor_TensorMap(1,1,2));
+
+ Journal_Printf( stream, "3-D\n");
+ tensorArray[0] = 0;
+ tensorArray[1] = 1;
+ tensorArray[2] = 2;
+ tensorArray[3] = 3;
+ tensorArray[4] = 4;
+ tensorArray[5] = 5;
+ tensorArray[6] = 6;
+ tensorArray[7] = 7;
+ tensorArray[8] = 8;
+
+ symmTensor[0] = 90;
+ symmTensor[1] = 100;
+ symmTensor[2] = 110;
+ symmTensor[3] = 120;
+ symmTensor[4] = 130;
+ symmTensor[5] = 140;
+
+ Journal_Printf( stream, "The full tensor:\n");
+ Journal_PrintTensorArray( stream, tensorArray, 3 );
+
+ Journal_Printf( stream, "The tensor Mapping using enumerated types:\n");
+ Journal_PrintValue( stream, tensorArray[FT3D_00]);
+ Journal_PrintValue( stream, tensorArray[FT3D_01]);
+ Journal_PrintValue( stream, tensorArray[FT3D_02]);
+ Journal_Printf( stream, " ---\n");
+ Journal_PrintValue( stream, tensorArray[FT3D_10]);
+ Journal_PrintValue( stream, tensorArray[FT3D_11]);
+ Journal_PrintValue( stream, tensorArray[FT3D_12]);
+ Journal_Printf( stream, " ---\n");
+ Journal_PrintValue( stream, tensorArray[FT3D_20]);
+ Journal_PrintValue( stream, tensorArray[FT3D_21]);
+ Journal_PrintValue( stream, tensorArray[FT3D_22]);
+
+ Journal_Printf( stream, "The symmetric tensor:\n");
+ Journal_PrintSymmetricTensor( stream, symmTensor, 3 );
+
+ Journal_Printf( stream, "The symmetric tensor Mapping using enumerated types:\n");
+ Journal_PrintValue( stream, symmTensor[ST3D_00]);
+ Journal_PrintValue( stream, symmTensor[ST3D_01]);
+ Journal_PrintValue( stream, symmTensor[ST3D_02]);
+ Journal_Printf( stream, " ---\n");
+ Journal_PrintValue( stream, symmTensor[ST3D_11]);
+ Journal_PrintValue( stream, symmTensor[ST3D_12]);
+ Journal_Printf( stream, " ---\n");
+ Journal_PrintValue( stream, symmTensor[ST3D_22]);
+
+ Journal_Printf( stream, "Test Mapping functions for Full Tensor ");
+ Journal_Printf( stream, "using TensorArray_TensorMap\n\n");
+ Journal_Printf( stream, "(0,0): %d = %d ", FT3D_00, TensorArray_TensorMap(0,0,3));
+ Journal_Printf( stream, "(0,1): %d = %d ", FT3D_01, TensorArray_TensorMap(0,1,3));
+ Journal_Printf( stream, "(0,2): %d = %d\n", FT3D_02, TensorArray_TensorMap(0,2,3));
+
+ Journal_Printf( stream, "(1,0): %d = %d ", FT3D_10, TensorArray_TensorMap(1,0,3));
+ Journal_Printf( stream, "(1,1): %d = %d ", FT3D_11, TensorArray_TensorMap(1,1,3));
+ Journal_Printf( stream, "(1,2): %d = %d\n", FT3D_12, TensorArray_TensorMap(1,2,3));
+
+ Journal_Printf( stream, "(2,0): %d = %d ", FT3D_20, TensorArray_TensorMap(2,0,3));
+ Journal_Printf( stream, "(2,1): %d = %d ", FT3D_21, TensorArray_TensorMap(2,1,3));
+ Journal_Printf( stream, "(2,2): %d = %d\n", FT3D_22, TensorArray_TensorMap(2,2,3));
+
+ Journal_Printf( stream, "Test Mapping functions for Symmetric Tensor ");
+ Journal_Printf( stream, "using SymmetricTensor_TensorMap\n\n");
+ Journal_Printf( stream, "(0,0): %d = %d ", ST3D_00, SymmetricTensor_TensorMap(0,0,3));
+ Journal_Printf( stream, "(0,1): %d = %d ", ST3D_01, SymmetricTensor_TensorMap(0,1,3));
+ Journal_Printf( stream, "(0,2): %d = %d\n", ST3D_02, SymmetricTensor_TensorMap(0,2,3));
+
+ Journal_Printf( stream, "(1,0): %d = %d ", ST3D_01, SymmetricTensor_TensorMap(1,0,3));
+ Journal_Printf( stream, "(1,1): %d = %d ", ST3D_11, SymmetricTensor_TensorMap(1,1,3));
+ Journal_Printf( stream, "(1,2): %d = %d\n", ST3D_12, SymmetricTensor_TensorMap(1,2,3));
+
+ Journal_Printf( stream, "(2,0): %d = %d ", ST3D_02, SymmetricTensor_TensorMap(2,0,3));
+ Journal_Printf( stream, "(2,1): %d = %d ", ST3D_12, SymmetricTensor_TensorMap(2,1,3));
+ Journal_Printf( stream, "(2,2): %d = %d\n", ST3D_22, SymmetricTensor_TensorMap(2,2,3));
+
Journal_Printf(stream, "\n/******************* Test Eigenvector 1 ************************/\n");
Journal_Printf( stream, "2D Case from Kresig, p. 371f\n\n");
symmTensor[0] = -5;
More information about the cig-commits
mailing list