Peano
Loading...
Searching...
No Matches
PatchToDoubleArrayWithSmartPointer.py
Go to the documentation of this file.
1# This file is part of the Peano project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
4import os
5
6from .DoF import DoFAssociation
7from .PatchToDoubleArray import FloatTypes
8from .PatchToDoubleArray import PatchToDoubleArray
9
10
12 """!
13
14 Realise patch via smart pointers
15
16 Converter which maps the patch 1:1 onto a double array administered
17 through a smart pointer. This is an alternative to the patch realisation
18 on the call stack, which can become really costly and lead to call stack
19 overflows.
20
21 """
22
23 def __init__(self, patch, float_type="double"):
24 """ """
25 super(PatchToDoubleArrayWithSmartPointer, self).__init__(patch, float_type)
26
28 return (
29 "peano4::stacks::STDVectorStackOverSmartPointers< "
30 + self.data.get_full_qualified_type()
31 + " >"
32 )
33
34 def construct_output(self, output):
36 """
37 Pass in a version of output
38 """
39 output.makefile.add_cpp_file(
40 self.data.subdirectory + self.data.namespace[-1] + "/" + self.data.name + ".cpp", generated=True
41 )
42 templatefile_prefix = (
43 os.path.realpath(__file__).replace(".pyc", "").replace(".py", "")
44 )
46 templatefile_prefix + ".template.h",
47 templatefile_prefix + ".template.cpp",
48 self.data.name,
49 self.data.namespace,
50 self.data.subdirectory + self.data.namespace[-1],
51 d,
52 True,
53 )
54 output.add(generated_files)
55
57 return (
58 """
59#include "peano4/stacks/STDVectorStackOverSmartPointers.h"
60#include \""""
61 + self.data.namespace[-1]
62 + """/"""
63 + self.data.name
64 + """.h"
65"""
66 )
__init__(self, patch, float_type="double")
includes Includes to be added to the generated file.
Very simple converter which maps the patch 1:1 onto a double array.