Commit a8c1873c authored by Emilia Juda's avatar Emilia Juda

added information about preprocessor directives

parent 49f13611
......@@ -240,6 +240,10 @@ If the two new attributes are not set to \texttt{nullptr} the array has been con
throught the Python to C++ converter. The already existing \texttt{m\_count} attribute
was retained in order to keep track of how many C++ references to the array there are.
Adding new attributes to the arrays might cause a significantly increased memory usage.
Therefore a preprocessor directive has been added to only include the additional arguments
if \texttt{NekPy} had been built (using the option \texttt{NEKTAR\_BUILD\_PYTHON}).
A new constructor has been added to the class template, as seen in Listing \ref{lst:new_const}.
\texttt{m\_memory\_pointer} and \texttt{m\_python\_decrement} have been set to
\texttt{nullptr} in the pre-existing constructors. A similar constructor was added for
......@@ -268,7 +272,7 @@ would decrement the reference counter of the NekPy array object. The detailed pr
for deleting arrays is described further in this section.
\begin{lstlisting}[caption={The modified destructor for C++ arrays.}, label={lst:destructor}, language=C++]
if( m_count == nullptr )
......@@ -278,6 +282,7 @@ for deleting arrays is described further in this section.
*m_count -= 1;
if( *m_count == 0 )
if (m_memory_pointer == nullptr)
ArrayDestructionPolicy<DataType>::Destroy( m_data, m_capacity );
......@@ -287,6 +292,10 @@ for deleting arrays is described further in this section.
ArrayDestructionPolicy<DataType>::Destroy( m_data, m_capacity );
MemoryManager<DataType>::RawDeallocate( m_data, m_capacity );
delete m_count; // Clean up the memory used for the reference count.
......@@ -456,3 +465,7 @@ conducted to determine whether the array is:
\item accessible to C++ program after being deleted in Python code,
\item accessible in Python script after being deleted from C++ objects.
Python files containing test scripts are currently located in
\path{library\Demos\Python\tests}. They should be converted into unit tests
that should be run when Python components are built.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment