[cig-commits] commit:
Mercurial
hg at geodynamics.org
Mon Nov 24 11:58:17 PST 2008
changeset: 19:20a06d360514
user: DavidLee
date: Fri Jan 25 02:41:30 2008 +0000
files: Utils/src/Operator.c Utils/src/Operator.h
description:
new binary operators for rising a value to a power and multiplying a scalar by a vector
diff -r ee4b415d47d7 -r 20a06d360514 Utils/src/Operator.c
--- a/Utils/src/Operator.c Fri Jan 11 00:38:28 2008 +0000
+++ b/Utils/src/Operator.c Fri Jan 25 02:41:30 2008 +0000
@@ -438,6 +438,29 @@ void Operator_TensorInvariant( void* ope
*result = TensorArray_2ndInvariant( operand0, self->dim );
}
+void Operator_RaiseToPower( void* operator, double* operand0, double* operand1, double* result ) {
+ Operator* self = (Operator*) operator;
+ Index val_I;
+
+ Operator_FirewallUnary( self );
+
+ for( val_I = 0; val_I < self->operandDofs ; val_I++ ) {
+ result[val_I] = pow( operand0[val_I], *operand1 );
+ }
+
+}
+
+void Operator_ScalarByVectorMultiplication( void* operator, double* operand0, double* operand1, double* result ) {
+ Operator* self = (Operator*) operator;
+ Index val_I;
+
+ Operator_FirewallUnary( self );
+
+ for( val_I = 0; val_I < self->operandDofs ; val_I++ ) {
+ result[val_I] = *operand0 * operand1[val_I];
+ }
+}
+
/* HACK - This function isn't extensible */
Operator* Operator_NewFromName(
Name name,
@@ -553,6 +576,16 @@ Operator* Operator_NewFromName(
numberOfOperands = 1;
_carryOut = Operator_Divergence;
}
+ else if ( ! strcasecmp( name, "RaiseToPower" ) ){
+ resultDofs = dim;
+ numberOfOperands = 2;
+ _carryOut = Operator_RaiseToPower;
+ }
+ else if ( ! strcasecmp( name, "ScalarByVectorMultiplication" ) ){
+ resultDofs = dim;
+ numberOfOperands = 2;
+ _carryOut = Operator_ScalarByVectorMultiplication;
+ }
else {
resultDofs = 0;
numberOfOperands = 0;
diff -r ee4b415d47d7 -r 20a06d360514 Utils/src/Operator.h
--- a/Utils/src/Operator.h Fri Jan 11 00:38:28 2008 +0000
+++ b/Utils/src/Operator.h Fri Jan 25 02:41:30 2008 +0000
@@ -107,6 +107,8 @@ typedef void (Operator_CarryOutBinaryOpe
void Operator_VerticalVorticity( void* operatorObject, double* velocityGradient, double* result ) ;
void Operator_Divergence( void* operatorObject, double* velocityGradient, double* result ) ;
void Operator_TensorInnerProduct( void* operatorObject, double* operand0, double* operand1, double* result );
+ void Operator_RaiseToPower( void* operatorObject, double* operand0, double* operand1, double* result );
+ void Operator_ScalarByVectorMultiplication( void* operatorObject, double* operand0, double* operand1, double* result );
Operator* Operator_NewFromName(
Name name,
More information about the CIG-COMMITS
mailing list