Peano
Loading...
Searching...
No Matches
PatchToDoubleArrayOnHeap.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 Even though the name of the class does not highlight this, we use smart
22 pointers here, i.e. we do not only store data on the heap. This means
23
24
25 """
26
27 def __init__(self, patch, float_type="double"):
28 """ """
29 super(PatchToDoubleArrayOnHeap, self).__init__(patch, float_type)
30
32 return (
33 "peano4::stacks::STDVectorStack< "
34 + self.data.get_full_qualified_type()
35 + " >"
36 )
37
38 def construct_output(self, output):
40 """
41 Pass in a version of output
42 """
43 output.makefile.add_cpp_file(
44 self.data.subdirectory + self.data.namespace[-1] + "/" + self.data.name + ".cpp", generated=True
45 )
46 templatefile_prefix = (
47 os.path.realpath(__file__).replace(".pyc", "").replace(".py", "")
48 )
50 templatefile_prefix + ".template.h",
51 templatefile_prefix + ".template.cpp",
52 self.data.name,
53 self.data.namespace,
54 self.data.subdirectory + self.data.namespace[-1],
55 d,
56 True,
57 )
58 output.add(generated_files)
59
61 return (
62 """
63#include "peano4/stacks/STDVectorOverContainerOfPointers.h"
64#include \""""
65 + self.data.namespace[-1]
66 + """/"""
67 + self.data.name
68 + """.h"
69"""
70 )
get_header_file_include(self)
This is the include statement for the data container.
__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.