[cig-commits] r4333 - in long/3D/Gale/trunk/src/StGermain: .
Discretisation/Utils/src
walter at geodynamics.org
walter at geodynamics.org
Thu Aug 17 17:17:33 PDT 2006
Author: walter
Date: 2006-08-17 17:17:31 -0700 (Thu, 17 Aug 2006)
New Revision: 4333
Modified:
long/3D/Gale/trunk/src/StGermain/
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h
Log:
r2711 at earth: boo | 2006-08-17 17:14:22 -0700
r2665 at earth (orig r3746): PatrickSunter | 2006-08-03 03:13:07 -0700
Added a rounding Operator.
* Currently it is hard-coded to round to 6 sig-figs. The current operator design
didn't seem to extend to reading in data like the number of rounding figures to use
from the constructor... may need to redesign it to fix this.
* Also be aware that since this rounds _after_ interpolation, you will still get
a different value from a field with all its nodal values rounded in-situ.
Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
- 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2710
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3745
+ 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2711
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3746
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c 2006-08-18 00:17:28 UTC (rev 4332)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.c 2006-08-18 00:17:31 UTC (rev 4333)
@@ -298,6 +298,8 @@
*result = (*operand0) * (*operand1);
}
+
+
void Operator_ScalarDivision( void* operator, double* operand0, double* operand1, double* result ) {
Operator* self = (Operator*) operator;
@@ -328,6 +330,20 @@
}
}
+void Operator_Rounding( void* operator, double* operand0, double* result ) {
+ Operator* self = (Operator*) operator;
+ // TODO: read this in from somewhere instead of just hard-coding it....
+ unsigned int nSigFigsToRoundTo = 6;
+ Index val_I;
+
+ Operator_FirewallUnary( self );
+
+ for( val_I = 0; val_I < self->operandDofs ; val_I++ ) {
+ result[val_I] = StG_RoundDoubleToNSigFigs( operand0[val_I], nSigFigsToRoundTo );
+ }
+}
+
+
void Operator_HorizontalDivergence( void* operator, double* velocityGradient, double* result ) {
Operator* self = (Operator*) operator;
@@ -336,6 +352,7 @@
*result = velocityGradient[0] + velocityGradient[8];
}
+
void Operator_VerticalVorticity( void* operator, double* velocityGradient, double* result ) {
Operator* self = (Operator*) operator;
@@ -344,6 +361,7 @@
*result = velocityGradient[2] - velocityGradient[6];
}
+
void Operator_Divergence( void* operator, double* velocityGradient, double* result ) {
Operator* self = (Operator*) operator;
@@ -351,6 +369,7 @@
TensorArray_GetTrace( velocityGradient, self->dim, result );
}
+
void Operator_TensorInnerProduct( void* operator, double* operand0, double* operand1, double* result ) {
Operator* self = (Operator*)operator;
@@ -443,6 +462,11 @@
numberOfOperands = 2;
_carryOut = Operator_VectorScale;
}
+ else if ( ! strcasecmp( name, "Rounding" ) ){
+ resultDofs = operandDofs;
+ numberOfOperands = 1;
+ _carryOut = Operator_Rounding;
+ }
else if ( ! strcasecmp( name, "TensorInnerProduct" ) ){
resultDofs = 1;
numberOfOperands = 2;
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h 2006-08-18 00:17:28 UTC (rev 4332)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Operator.h 2006-08-18 00:17:31 UTC (rev 4333)
@@ -100,6 +100,7 @@
void Operator_ScalarMultiplication( void* operatorObject, double* operand0, double* operand1, double* result ) ;
void Operator_ScalarDivision( void* operatorObject, double* operand0, double* operand1, double* result ) ;
void Operator_VectorScale( void* operatorObject, double* operand0, double* operand1, double* result);
+ void Operator_Rounding( void* operator, double* operand0, double* result );
void Operator_HorizontalDivergence( void* operatorObject, double* velocityGradient, double* result ) ;
void Operator_VerticalVorticity( void* operatorObject, double* velocityGradient, double* result ) ;
void Operator_Divergence( void* operatorObject, double* velocityGradient, double* result ) ;
More information about the cig-commits
mailing list