40 estimates:
"double**",
42 weights:
"const double*",
43 timeStepSize:
"double",
45 dt =
Float(
"timeStepSize")
47 [[0, NumberOfUnknowns + NumberOfAuxiliaryVariables], [0, NumberOfDoFs], [0, 1]],
51 [[0, NumberOfUnknowns], [0, NumberOfDoFs], [0, NumberOfEstimates]],
"estimates"
54 [[0, NumberOfUnknowns + NumberOfAuxiliaryVariables], [0, NumberOfDoFs], [0, 1]],
57 W = DiagonalMatrix(NumberOfEstimates,
"weights")
59 dot(W, K[0:NumberOfUnknowns, :, :], contribution)
60 out[0:NumberOfUnknowns, :, 0] = out[0:NumberOfUnknowns, :, 0] + dt * contribution
70 Translate linearCombinationOfRungeKuttaEstimates() into C++
72 The kernel ends up in kernels/rungekutta_linear_combination.h in the
73 output directory. It is a function template over NumberOfDoFs,
74 NumberOfUnknowns, NumberOfAuxiliaryVariables and NumberOfEstimates within
75 namespace. It does not depend on any solver, nor on the Runge-Kutta
76 scheme (the weights and the number of estimates enter at the call site),
77 so several solvers within one project can share it. Each of them calls
78 this routine, but only the first call generates the file: The DSLHyPE
79 translation appends to existing files, i.e. a second generation would
80 define the function template twice.
82 @param namespace: [str]
83 Namespace of the generated function template, usually the Peano
86 @param output_directory: str
87 Directory the kernels/ subdirectory is created in, usually the Peano
91 header = os.path.join(
92 output_directory,
"kernels", LINEAR_COMBINATION_KERNEL_FILE +
".h"
94 if os.path.exists(header):
97 dslhype.translate_dslhype_function(
98 function=linearCombinationOfRungeKuttaEstimates,
99 function_namespace=namespace,
100 template_parameters=[
112 functor_parameters=[],
114 output_file_name=LINEAR_COMBINATION_KERNEL_FILE,
115 target=dslhype.Target.Serial,
117 output_directory=output_directory,
120 os.path.join(output_directory,
"kernels"), LINEAR_COMBINATION_KERNEL_FILE
create_linear_combination_call(namespace, number_of_dofs, unknowns, auxiliary_variables, weights, solution, estimates, output, time_step_size)
C++ code which invokes the kernel from generate_linear_combination_kernel().
"void" linearCombinationOfRungeKuttaEstimates("double**" solution, "double**" estimates, "double**" output, "const double*" weights, "double" timeStepSize)
DSLHyPE kernel for the linear combinations of Runge-Kutta.