aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface.ccl2
-rw-r--r--src/Operators.c52
2 files changed, 54 insertions, 0 deletions
diff --git a/interface.ccl b/interface.ccl
index 94a4bb7..51d9647 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -211,6 +211,8 @@ PROVIDES FUNCTION MoLNumIntegratorSubsteps WITH MoL_NumIntegratorSubsteps \
### to override low-level grid variable operations. ###
##############################################################
+# Computes:
+# var = scale * var + \sum_i^nsrcs facts[i] * scrcs[i][tls[i]]
CCTK_INT FUNCTION LinearCombination \
(CCTK_POINTER_TO_CONST IN cctkGH, \
CCTK_INT IN var, \
diff --git a/src/Operators.c b/src/Operators.c
index fa78524..21ff8b2 100644
--- a/src/Operators.c
+++ b/src/Operators.c
@@ -145,6 +145,58 @@ op_real_update_3(CCTK_REAL *restrict const varptr,
+ /*@@
+ @routine MoL_LinearCombination
+ @date Tue Jan 22 16:00:28 EST 2013
+ @author Erik Schnetter
+ @desc
+ MoL's low level operator. Computes linear combination of grid functions.
+ Computes:
+ var = scale * var + \sum_i^nsrcs facts[i] * scrcs[i][tls[i]]
+ @enddesc
+ @var GH
+ @vdesc Pointer to CCTK GH
+ @vtype const cGH *
+ @vio in
+ @endvar
+ @var var
+ @vdesc global index of target variable
+ @vtype int
+ @vio inout
+ @endvar
+ @var scale
+ @vdesc scale target by this
+ @vtype CCTK_REAL
+ @vio in
+ @endvar
+ @var srcs
+ @vdesc global index of variable
+ @vtype int[]
+ @vio in
+ @endvar
+ @var tls
+ @vdesc time levels of srcs variables to use
+ @vtype int[]
+ @vio in
+ @endvar
+ @var facts
+ @vdesc scale factors for srcs variables
+ @vtype CCTK_REAL[]
+ @vio in
+ @endvar
+ @var nsrcs
+ @vdesc number of srcs variables
+ @vtype int
+ @vio in
+ @endvar
+
+ @returntype CCTK_INT
+ @returndesc
+ 0 for success, or<BR>
+ @endreturndesc
+
+@@*/
+
CCTK_INT
MoL_LinearCombination(cGH const *const cctkGH,
CCTK_INT const var,