1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
@shBang #!/usr/bin/env python3
@*
ConstantIPOperator.tmpl
Interaction-picture transverse derivative operator
Created by Graham Dennis on 2007-10-06.
Copyright (c) 2007-2012, Graham Dennis
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*@
@extends xpdeint.Operators._IPOperator
@attr $calculateOperatorFieldFunctionArguments = []
@def calculateOperatorFieldFunctionContents($function)
@#
${integrator.createStepVariable}@slurp
@super(function)
@#
@end def
@def insideCalculateOperatorFieldLoops($codeString)
@#
${insideCalculateOperatorFieldLoopsBegin}@slurp
@#
@# We expect the integrator to have defined '_step'
@#
// The purpose of the following define is to give a (somewhat helpful) compile-time error
// if the user has attempted to use the propagation dimension variable in a constant IP operator/
// The user probably shouldn't be doing this, but if they must, they should use a non-constant EX
// operator instead
#define ${propagationDimension} Dont_use_propagation_dimension_${propagationDimension}_in_constant_IP_operator___Use_non_constant_EX_operator_instead
// ************** Operator code *****************
${codeString}@slurp
// **********************************************
#undef ${propagationDimension}
@# Loop over the propagation step fractions
@for $fractionIndex, $propagationStepFraction in enumerate($integrator.ipPropagationStepFractions)
@# Loop over each operator component
@for $operatorComponentNumber, $operatorComponent in enumerate($operatorComponents.keys())
@set $offsetIndex = $operatorComponentNumber + $fractionIndex * len($operatorComponents)
_${operatorVector.id}[_${operatorVector.id}_index_pointer + ${offsetIndex}] = ${expFunction}(${operatorComponent}${valueSuffix} * $propagationStepFraction * _step);
@end for
@end for
@#
@end def
@def exponentIndex
(abs(_exponent) - 1) * ${len($operatorComponents)}@slurp
@end def
|