...
 
Commits (11)
#include <iostream>
#include <TNL/Containers/Array.h>
using namespace TNL;
using namespace TNL::Containers;
int main( int argc, char* argv[] )
{
/****
* Allocate an array on host
*/
const int size = 10;
int* ai = new int[ size ];
/****
* Bind the data with TNL array
*/
Array< int > host_array;
host_array.bind( ai, size );
/****
* Initialize the data using the TNL array
*/
host_array = 66;
/****
* Check the data
*/
for( int i = 0; i < size; i++ )
std::cout << ai[ i ] << " ";
std::cout << std::endl;
/****
* Free the allocated data
*/
delete[] ai;
}
ArrayBinding-1.cpp
\ No newline at end of file
#include <iostream>
#include <TNL/Containers/Array.h>
using namespace TNL;
using namespace TNL::Containers;
void initArray( Array< int >& a )
{
/****
* Create new array, bind it with 'a' and initialize it
*/
Array< int > b( 10 );
a.bind( b );
b = 10;
/****
* Show that both arrays share the same data
*/
std::cout << "a data in initArray function is " << a.getData() << std::endl;
std::cout << "a value in initArray function is " << a << std::endl;
std::cout << "--------------------------------------" << std::endl;
std::cout << "b data in initArray function is " << b.getData() << std::endl;
std::cout << "b in initArray function is " << b << std::endl;
std::cout << "--------------------------------------" << std::endl;
}
int main( int argc, char* argv[] )
{
/****
* Create array but do not initialize it
*/
Array< int > a;
/***
* Call function initArray for the array initialization
*/
initArray( a );
/****
* Print the initialized array
*/
std::cout << "a data in main function is " << a.getData() << std::endl;
std::cout << "a in main function is " << a << std::endl;
}
ArrayBinding-2.cpp
\ No newline at end of file
#include <iostream>
#include <TNL/Containers/Array.h>
using namespace TNL;
using namespace TNL::Containers;
int main( int argc, char* argv[] )
{
/****
* Allocate data for all degrees of freedom
*/
const int size = 5;
Array< float > a( 3 * size );
/***
* Partition the data into density and velocity components
*/
Array< float > rho( a, 0, size );
Array< float > v_1( a, size, size );
Array< float > v_2( a, 2 * size, size );
rho = 10.0;
v_1 = 1.0;
v_2 = 0.0;
/****
* Print the initialized arrays
*/
std::cout << "rho = " << rho << std::endl;
std::cout << "v1 = " << v_1 << std::endl;
std::cout << "v2 = " << v_2 << std::endl;
std::cout << "a = " << a << std::endl;
}
ArrayBinding-3.cpp
\ No newline at end of file
IF( BUILD_CUDA )
CUDA_ADD_EXECUTABLE( ArrayAllocation ArrayAllocation.cu )
ADD_CUSTOM_COMMAND( COMMAND ArrayAllocation > ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/ArrayAllocation.out OUTPUT ArrayAllocation.out )
CUDA_ADD_EXECUTABLE( ArrayBinding-1 ArrayBinding-1.cu )
ADD_CUSTOM_COMMAND( COMMAND ArrayBinding-1 > ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/ArrayBinding-1.out OUTPUT ArrayBinding-1.out )
CUDA_ADD_EXECUTABLE( ArrayBinding-2 ArrayBinding-2.cu )
ADD_CUSTOM_COMMAND( COMMAND ArrayBinding-2 > ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/ArrayBinding-2.out OUTPUT ArrayBinding-2.out )
CUDA_ADD_EXECUTABLE( ArrayBinding-3 ArrayBinding-3.cu )
ADD_CUSTOM_COMMAND( COMMAND ArrayBinding-3 > ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/ArrayBinding-3.out OUTPUT ArrayBinding-3.out )
CUDA_ADD_EXECUTABLE( ArrayIO ArrayIO.cu )
ADD_CUSTOM_COMMAND( COMMAND ArrayIO > ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/ArrayIO.out OUTPUT ArrayIO.out )
CUDA_ADD_EXECUTABLE( ArrayView-1 ArrayView-1.cu )
......@@ -28,9 +22,6 @@ ENDIF()
IF( BUILD_CUDA )
ADD_CUSTOM_TARGET( TutorialsArrays-cuda ALL DEPENDS
ArrayAllocation.out
ArrayBinding-1.out
ArrayBinding-2.out
ArrayBinding-3.out
ArrayIO.out
ArrayView-1.out
ArrayView-2.out
......
......@@ -6,14 +6,13 @@ This tutorial introduces arrays in TNL. There are three types - common arrays wi
## Table of Contents
1. [Arrays](#arrays)
1. [Arrays binding](#arrays_binding)
2. [Array views](#array_views)
3. [Accessing the array elements](#accessing_the_array_elements)
1. [Array views](#array_views)
2. [Accessing the array elements](#accessing_the_array_elements)
1. [Accessing the array elements with `operator[]`](#accessing_the_array_elements_with_operator)
2. [Accessing the array elements with `setElement` and `getElement`](#accessing_the_array_elements_with_set_get_element)
4. [Arrays initiation with lambdas](#arrays_initiation_with_lambdas)
5. [Checking the array contents](#checking_the_array_contents)
6. [IO operations with arrays](#io_operations_with-arrays)
3. [Arrays initiation with lambdas](#arrays_initiation_with_lambdas)
4. [Checking the array contents](#checking_the_array_contents)
5. [IO operations with arrays](#io_operations_with-arrays)
2. [Static arrays](#static_arrays)
3. [Distributed arrays](#distributed_arrays)
......@@ -34,36 +33,11 @@ The result looks as follows:
\include ArrayAllocation.out
### Arrays binding <a name="arrays_binding"></a>
Arrays can share data with each other or data allocated elsewhere. It is called binding and it can be done using method `bind`. The following example shows how to bind data allocated on host using the `new` operator. In this case, the TNL array do not free this data at the and of its life cycle.
\include ArrayBinding-1.cpp
It generates output like this:
\include ArrayBinding-1.out
One may also bind TNL array with another TNL array. In this case, the data is shared and can be shared between multiple arrays. Reference counter ensures that the data is freed after the last array sharing the data ends its life cycle.
\include ArrayBinding-2.cpp
The result is:
\include ArrayBinding-2.out
Binding may also serve for data partitioning. Both CPU and GPU prefer data allocated in large contiguous blocks instead of many fragmented pieces of allocated memory. Another reason why one might want to partition the allocated data is demonstrated in the following example. Consider a situation of solving incompressible flow in 2D. The degrees of freedom consist of density and two components of velocity. Mostly, we want to manipulate either density or velocity. But some numerical solvers may need to have all degrees of freedom in one array. It can be managed like this:
\include ArrayBinding-3.cpp
The result is:
\include ArrayBinding-3.out
### Array views <a name="array_views"></a>
Because of the data sharing, TNL Array is relatively complicated structure. In many situations, we prefer lightweight structure which only encapsulates the data pointer and keeps information about the data size. Passing array structure to GPU kernel can be one example. For this purpose there is `ArrayView` in TNL. It is templated structure having the same template parameters as `Array` (it means `Value`, `Device` and `Index`). The following code snippet shows how to create an array view.
Arrays cannot share data with each other or data allocated elsewhere. This can be achieved with the `ArrayView` structure which has similar semantics to `Array`, but it does not handle allocation and deallocation of the data. Hence, array view cannot be resized, but it can be used to wrap data allocated elsewhere (e.g. using an `Array` or an operator `new`) and to partition large arrays into subarrays. The process of wrapping external data with a view is called _binding_.
The following code snippet shows how to create an array view.
\include ArrayView-1.cpp
......@@ -71,7 +45,7 @@ The output is:
\include ArrayView-1.out
Of course, one may bind his own data into array view:
You can also bind external data into array view:
\include ArrayView-2.cpp
......@@ -79,7 +53,7 @@ Output:
\include ArrayView-2.out
Array view never allocated or deallocate the memory managed by it. Therefore it can be created even in CUDA kernels which is not true for `Array`.
Since array views do not allocate or deallocate memory, they can be created even in CUDA kernels, which is not possible with `Array`. `ArrayView` can also be passed-by-value into CUDA kernels or captured-by-value by device lambda functions, because the `ArrayView`'s copy-constructor makes only a shallow copy (i.e., it copies only the data pointer and size).
### Accessing the array elements <a name="accessing_the_array_elements"></a>
......
......@@ -2,7 +2,7 @@
#define HeatEquationBenchmarkPROBLEM_H_
#include <TNL/Problems/PDEProblem.h>
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/MeshFunctionView.h>
#include <TNL/Solvers/PDE/ExplicitUpdater.h>
#include "Tuning/ExplicitUpdater.h"
......@@ -26,8 +26,8 @@ class HeatEquationBenchmarkProblem:
typedef typename DifferentialOperator::RealType RealType;
typedef typename Mesh::DeviceType DeviceType;
typedef typename DifferentialOperator::IndexType IndexType;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Pointers::SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer;
typedef Functions::MeshFunctionView< Mesh > MeshFunctionViewType;
typedef Pointers::SharedPointer< MeshFunctionViewType, DeviceType > MeshFunctionViewPointer;
typedef PDEProblem< Mesh, Communicator, RealType, DeviceType, IndexType > BaseType;
typedef Pointers::SharedPointer< DifferentialOperator > DifferentialOperatorPointer;
typedef Pointers::SharedPointer< BoundaryCondition > BoundaryConditionPointer;
......@@ -86,7 +86,7 @@ class HeatEquationBenchmarkProblem:
BoundaryConditionPointer boundaryConditionPointer;
RightHandSidePointer rightHandSidePointer;
MeshFunctionPointer fu, u;
MeshFunctionViewPointer fu, u;
String cudaKernelType;
......@@ -95,8 +95,8 @@ class HeatEquationBenchmarkProblem:
RightHandSide* cudaRightHandSide;
DifferentialOperator* cudaDifferentialOperator;
TNL::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > tuningExplicitUpdater;
TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
TNL::ExplicitUpdater< Mesh, MeshFunctionViewType, DifferentialOperator, BoundaryCondition, RightHandSide > tuningExplicitUpdater;
TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionViewType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
};
......
......@@ -117,7 +117,7 @@ void
HeatEquationBenchmarkProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator, Communicator >::
bindDofs( DofVectorPointer& dofsPointer )
{
this->u->bind( this->getMesh(), dofsPointer );
this->u->bind( this->getMesh(), *dofsPointer );
}
template< typename Mesh,
......@@ -131,7 +131,8 @@ setInitialCondition( const Config::ParameterContainer& parameters,
DofVectorPointer& dofsPointer )
{
const String& initialConditionFile = parameters.getParameter< String >( "initial-condition" );
Functions::MeshFunction< Mesh > u( this->getMesh(), dofsPointer );
MeshFunctionViewType u;
u.bind( this->getMesh(), *dofsPointer );
try
{
u.boundLoad( initialConditionFile );
......@@ -183,9 +184,9 @@ makeSnapshot( const RealType& time,
{
std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
this->bindDofs( dofsPointer );
MeshFunctionType u;
MeshFunctionViewType u;
u.bind( this->getMesh(), *dofsPointer );
FileName fileName;
fileName.setFileNameBase( "u-" );
fileName.setExtension( "tnl" );
......@@ -475,8 +476,8 @@ getExplicitUpdate( const RealType& time,
//typedef typename MeshType::Cell CellType;
//std::cerr << "Size of entity is ... " << sizeof( TestEntity< MeshType > ) << " vs. " << sizeof( CellType ) << std::endl;
typedef typename CellType::CoordinatesType CoordinatesType;
u->bind( mesh, uDofs );
fu->bind( mesh, fuDofs );
u->bind( mesh, *uDofs );
fu->bind( mesh, *fuDofs );
fu->getData().setValue( 1.0 );
const CoordinatesType begin( 0,0 );
const CoordinatesType& end = mesh->getDimensions();
......@@ -493,7 +494,7 @@ getExplicitUpdate( const RealType& time,
Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
for( IndexType gridYIdx = 0; gridYIdx < cudaYGrids; gridYIdx ++ )
for( IndexType gridXIdx = 0; gridXIdx < cudaXGrids; gridXIdx ++ )
boundaryConditionsTemplatedCompact< MeshType, CellType, BoundaryCondition, MeshFunctionType >
boundaryConditionsTemplatedCompact< MeshType, CellType, BoundaryCondition, MeshFunctionViewType >
<<< cudaBlocks, cudaBlockSize >>>
( &mesh.template getData< Devices::Cuda >(),
&boundaryConditionPointer.template getData< Devices::Cuda >(),
......@@ -511,7 +512,7 @@ getExplicitUpdate( const RealType& time,
//std::cerr << "Computing the heat equation ..." << std::endl;
for( IndexType gridYIdx = 0; gridYIdx < cudaYGrids; gridYIdx ++ )
for( IndexType gridXIdx = 0; gridXIdx < cudaXGrids; gridXIdx ++ )
heatEquationTemplatedCompact< MeshType, CellType, DifferentialOperator, RightHandSide, MeshFunctionType >
heatEquationTemplatedCompact< MeshType, CellType, DifferentialOperator, RightHandSide, MeshFunctionViewType >
<<< cudaBlocks, cudaBlockSize >>>
( &mesh.template getData< DeviceType >(),
&differentialOperatorPointer.template getData< DeviceType >(),
......@@ -532,8 +533,8 @@ getExplicitUpdate( const RealType& time,
{
//if( !this->cudaMesh )
// this->cudaMesh = tnlCuda::passToDevice( &mesh );
this->u->bind( mesh, uDofs );
this->fu->bind( mesh, fuDofs );
this->u->bind( mesh, *uDofs );
this->fu->bind( mesh, *fuDofs );
//explicitUpdater.setGPUTransferTimer( this->gpuTransferTimer );
this->explicitUpdater.template update< typename Mesh::Cell, CommunicatorType >( time, tau, mesh, this->u, this->fu );
}
......@@ -541,19 +542,19 @@ getExplicitUpdate( const RealType& time,
{
if( std::is_same< DeviceType, Devices::Cuda >::value )
{
this->u->bind( mesh, uDofs );
this->fu->bind( mesh, fuDofs );
this->u->bind( mesh, *uDofs );
this->fu->bind( mesh, *fuDofs );
/*this->explicitUpdater.template update< typename Mesh::Cell >( time, tau, mesh, this->u, this->fu );
return;*/
#ifdef WITH_TNL
using ExplicitUpdaterType = TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide >;
using ExplicitUpdaterType = TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionViewType, DifferentialOperator, BoundaryCondition, RightHandSide >;
using Cell = typename MeshType::Cell;
using MeshTraverserType = Meshes::Traverser< MeshType, Cell >;
using UserData = TNL::Solvers::PDE::ExplicitUpdaterTraverserUserData< RealType,
MeshFunctionType,
MeshFunctionViewType,
DifferentialOperator,
BoundaryCondition,
RightHandSide >;
......@@ -561,12 +562,12 @@ getExplicitUpdate( const RealType& time,
#else
//using CellConfig = Meshes::GridEntityNoStencilStorage;
using CellConfig = Meshes::GridEntityCrossStencilStorage< 1 >;
using ExplicitUpdaterType = ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide >;
using ExplicitUpdaterType = ExplicitUpdater< Mesh, MeshFunctionViewType, DifferentialOperator, BoundaryCondition, RightHandSide >;
using Cell = typename MeshType::Cell;
//using Cell = SimpleCell< Mesh, CellConfig >;
using MeshTraverserType = Traverser< MeshType, Cell >;
using UserData = ExplicitUpdaterTraverserUserData< RealType,
MeshFunctionType,
MeshFunctionViewType,
DifferentialOperator,
BoundaryCondition,
RightHandSide >;
......@@ -735,16 +736,15 @@ assemblyLinearSystem( const RealType& time,
{
// TODO: the instance should be "cached" like this->explicitUpdater, but there is a problem with MatrixPointer
Solvers::PDE::LinearSystemAssembler< Mesh,
MeshFunctionType,
MeshFunctionViewType,
DifferentialOperator,
BoundaryCondition,
RightHandSide,
Solvers::PDE::BackwardTimeDiscretisation,
typename DofVectorPointer::ObjectType > systemAssembler;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Pointers::SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer;
MeshFunctionPointer u( this->getMesh(), *_u );
MeshFunctionViewPointer u;
u->bind( this->getMesh(), *_u );
systemAssembler.setDifferentialOperator( this->differentialOperator );
systemAssembler.setBoundaryConditions( this->boundaryCondition );
systemAssembler.setRightHandSide( this->rightHandSide );
......
......@@ -18,7 +18,7 @@
#include <TNL/Devices/Cuda.h>
#include <TNL/Containers/StaticVector.h>
#include <TNL/Meshes/Grid.h>
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/MeshFunctionView.h>
#include "pure-c-rhs.h"
using namespace std;
......@@ -325,13 +325,13 @@ bool solveHeatEquationCuda( const Config::ParameterContainer& parameters,
GridPointer gridPointer;
gridPointer->setDimensions( gridXSize, gridYSize );
gridPointer->setDomain( PointType( 0.0, 0.0 ), PointType( domainXSize, domainYSize ) );
Containers::Vector< Real, Devices::Cuda, Index > vecU;
Containers::VectorView< Real, Devices::Cuda, Index > vecU;
vecU.bind( cuda_u, gridXSize * gridYSize );
Functions::MeshFunction< GridType > meshFunction;
Functions::MeshFunctionView< GridType > meshFunction;
meshFunction.bind( gridPointer, vecU );
meshFunction.save( "simple-heat-equation-initial.tnl" );
Containers::Vector< Real, Devices::Cuda, Index > vecAux;
Containers::VectorView< Real, Devices::Cuda, Index > vecAux;
vecAux.bind( cuda_aux, gridXSize * gridYSize );
vecAux.setValue( 0.0 );
......@@ -552,9 +552,9 @@ bool solveHeatEquationHost( const Config::ParameterContainer& parameters,
Pointers::SharedPointer< GridType > gridPointer;
gridPointer->setDimensions( gridXSize, gridYSize );
gridPointer->setDomain( PointType( 0.0, 0.0 ), PointType( domainXSize, domainYSize ) );
Containers::Vector< Real, Devices::Host, Index > vecU;
Containers::VectorView< Real, Devices::Host, Index > vecU;
vecU.bind( u, gridXSize * gridYSize );
Functions::MeshFunction< GridType > meshFunction;
Functions::MeshFunctionView< GridType > meshFunction;
meshFunction.bind( gridPointer, vecU );
meshFunction.save( "simple-heat-equation-result.tnl" );
......
......@@ -27,12 +27,14 @@ struct SpmvBenchmarkResult
using HostVector = Containers::Vector< Real, Devices::Host, Index >;
using BenchmarkVector = Containers::Vector< Real, Device, Index >;
SpmvBenchmarkResult( const HostVector& csrResult, const BenchmarkVector& benchmarkResult )
: csrResult( csrResult ), benchmarkResult( benchmarkResult ){};
SpmvBenchmarkResult( const HostVector& csrResult,
const BenchmarkVector& benchmarkResult,
const IndexType nonzeros )
: csrResult( csrResult ), benchmarkResult( benchmarkResult ), nonzeros( nonzeros ){};
virtual HeaderElements getTableHeader() const override
{
return HeaderElements( {"time", "stddev", "stddev/time", "bandwidth", "speedup", "CSR Diff.Max", "CSR Diff.L2"} );
return HeaderElements( {"non-zeros", "time", "stddev", "stddev/time", "bandwidth", "speedup", "CSR Diff.Max", "CSR Diff.L2"} );
}
virtual RowElements getRowElements() const override
......@@ -41,7 +43,7 @@ struct SpmvBenchmarkResult
benchmarkResultCopy = benchmarkResult;
auto diff = csrResult - benchmarkResultCopy;
RowElements elements;
elements << time << stddev << stddev/time << bandwidth;
elements << nonzeros << time << stddev << stddev/time << bandwidth;
if( speedup != 0.0 )
elements << speedup;
else elements << "N/A";
......@@ -51,6 +53,7 @@ struct SpmvBenchmarkResult
const HostVector& csrResult;
const BenchmarkVector& benchmarkResult;
const IndexType nonzeros;
};
} //namespace Benchmarks
......
......@@ -158,7 +158,7 @@ benchmarkSpMV( Benchmark& benchmark,
benchmark.setMetadataColumns( Benchmark::MetadataColumns({
{ "matrix name", convertToString( inputFileName ) },
{ "non-zeros", convertToString( hostMatrix.getNonzeroElementsCount() ) },
//{ "non-zeros", convertToString( hostMatrix.getNonzeroElementsCount() ) },
{ "rows", convertToString( hostMatrix.getRows() ) },
{ "columns", convertToString( hostMatrix.getColumns() ) },
{ "matrix format", MatrixInfo< HostMatrix >::getFormat() }
......@@ -181,7 +181,7 @@ benchmarkSpMV( Benchmark& benchmark,
hostMatrix.vectorProduct( hostInVector, hostOutVector );
};
SpmvBenchmarkResult< Real, Devices::Host, int > hostBenchmarkResults( csrResultVector, hostOutVector );
SpmvBenchmarkResult< Real, Devices::Host, int > hostBenchmarkResults( csrResultVector, hostOutVector, hostMatrix.getNonzeroElementsCount() );
benchmark.time< Devices::Host >( resetHostVectors, "CPU", spmvHost, hostBenchmarkResults );
/***
......@@ -199,7 +199,7 @@ benchmarkSpMV( Benchmark& benchmark,
auto spmvCuda = [&]() {
cudaMatrix.vectorProduct( cudaInVector, cudaOutVector );
};
SpmvBenchmarkResult< Real, Devices::Cuda, int > cudaBenchmarkResults( csrResultVector, cudaOutVector );
SpmvBenchmarkResult< Real, Devices::Cuda, int > cudaBenchmarkResults( csrResultVector, cudaOutVector, cudaMatrix.getNonzeroElementsCount() );
benchmark.time< Devices::Cuda >( resetCudaVectors, "GPU", spmvCuda, cudaBenchmarkResults );
#endif
std::cout << std::endl;
......@@ -233,7 +233,7 @@ benchmarkSpmvSynthetic( Benchmark& benchmark,
//
benchmark.setMetadataColumns( Benchmark::MetadataColumns({
{ "matrix name", convertToString( inputFileName ) },
{ "non-zeros", convertToString( csrHostMatrix.getNumberOfNonzeroMatrixElements() ) },
//{ "non-zeros", convertToString( csrHostMatrix.getNumberOfNonzeroMatrixElements() ) },
{ "rows", convertToString( csrHostMatrix.getRows() ) },
{ "columns", convertToString( csrHostMatrix.getColumns() ) },
{ "matrix format", String( "CSR" ) }
......@@ -250,7 +250,8 @@ benchmarkSpmvSynthetic( Benchmark& benchmark,
csrHostMatrix.vectorProduct( hostInVector, hostOutVector );
};
benchmark.time< Devices::Cuda >( resetHostVectors, "CPU", spmvCSRHost );
SpmvBenchmarkResult< Real, Devices::Host, int > csrBenchmarkResults( hostOutVector, hostOutVector, csrHostMatrix.getNonzeroElementsCount() );
benchmark.time< Devices::Cuda >( resetHostVectors, "CPU", spmvCSRHost, csrBenchmarkResults );
////
// Perform benchmark on CUDA device with cuSparse as a reference GPU format
......@@ -258,7 +259,7 @@ benchmarkSpmvSynthetic( Benchmark& benchmark,
#ifdef HAVE_CUDA
benchmark.setMetadataColumns( Benchmark::MetadataColumns({
{ "matrix name", convertToString( inputFileName ) },
{ "non-zeros", convertToString( csrHostMatrix.getNumberOfNonzeroMatrixElements() ) },
//{ "non-zeros", convertToString( csrHostMatrix.getNumberOfNonzeroMatrixElements() ) },
{ "rows", convertToString( csrHostMatrix.getRows() ) },
{ "columns", convertToString( csrHostMatrix.getColumns() ) },
{ "matrix format", String( "cuSparse" ) }
......@@ -286,7 +287,8 @@ benchmarkSpmvSynthetic( Benchmark& benchmark,
cusparseMatrix.vectorProduct( cusparseInVector, cusparseOutVector );
};
benchmark.time< Devices::Cuda >( resetCusparseVectors, "GPU", spmvCusparse );
SpmvBenchmarkResult< Real, Devices::Host, int > cusparseBenchmarkResults( hostOutVector, hostOutVector, csrHostMatrix.getNonzeroElementsCount() );
benchmark.time< Devices::Cuda >( resetCusparseVectors, "GPU", spmvCusparse, cusparseBenchmarkResults );
#endif
benchmarkSpMV< Real, SparseMatrixLegacy_CSR_Scalar >( benchmark, hostOutVector, inputFileName, verboseMR );
......
......@@ -60,21 +60,36 @@ df.sort_index(axis=1, inplace=True)
# Drop CPU speedup
df.drop(columns=('BiEllpack Legacy', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('BiEllpack', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('CSR', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('CSR Legacy', 'CPU','speedup'), axis=1, inplace=True )
#df.drop(columns=('CSR Legacy Adaptive', 'CPU','speedup'), axis=1, inplace=True )
#df.drop(columns=('CSR Legacy Light', 'CPU','speedup'), axis=1, inplace=True )
#df.drop(columns=('CSR Legacy Scalar', 'CPU','speedup'), axis=1, inplace=True )
#df.drop(columns=('CSR Legacy Stream', 'CPU','speedup'), axis=1, inplace=True )
#df.drop(columns=('CSR Legacy Vector', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('ChunkedEllpack Legacy', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('Ellpack', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('Ellpack Legacy', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('SlicedEllpack', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('SlicedEllpack Legacy', 'CPU','speedup'), axis=1, inplace=True )
df.drop(columns=('cuSparse', 'CPU'), axis=1, inplace=True )
#df.drop(columns=('cuSparse', 'CPU'), axis=1, inplace=True )
print( "Exporting data frame to log.html..." )
pandas.options.display.float_format = '{:,.4f}'.format
df.to_html("log.html")
print( "Computing speed-up of formats...")
# Add speedup compared to CSR and cuSparse
df["BiEllpack Legacy", "CPU", "CSR speedup"] = df["BiEllpack Legacy", "CPU", "time"] / df["CSR", "CPU", "time"]
df["BiEllpack Legacy", "GPU", "cuSparse speedup"] = df["BiEllpack Legacy", "GPU", "time"] / df["cuSparse", "GPU", "time"]
df["BiEllpack", "CPU", "CSR speedup"] = df["BiEllpack", "CPU", "time"] / df["CSR", "CPU", "time"]
df["BiEllpacky", "GPU", "cuSparse speedup"] = df["BiEllpack", "GPU", "time"] / df["cuSparse", "GPU", "time"]
df["CSR", "GPU", "cuSparse speedup"] = df["CSR", "GPU", "time"] / df["cuSparse", "GPU", "time"]
df["CSR Legacy", "GPU", "cuSparse speedup"] = df["CSR Legacy", "GPU", "time"] / df["cuSparse", "GPU", "time"]
#df["CSR Legacy Adaptive", "GPU", "cuSparse speedup"] = df["CSR Legacy Adaptive", "GPU", "time"] / df["cuSparse", "GPU", "time"]
#df["CSR Legacy Light", "GPU", "cuSparse speedup"] = df["CSR Legacy Light", "GPU", "time"] / df["cuSparse", "GPU", "time"]
#df["CSR Legacy Scalar", "GPU", "cuSparse speedup"] = df["CSR Legacy Scalar", "GPU", "time"] / df["cuSparse", "GPU", "time"]
#df["CSR Legacy Stream", "GPU", "cuSparse speedup"] = df["CSR Legacy Stream", "GPU", "time"] / df["cuSparse", "GPU", "time"]
#df["CSR Legacy Vector", "GPU", "cuSparse speedup"] = df["CSR Legacy Vector", "GPU", "time"] / df["cuSparse", "GPU", "time"]
df["ChunkedEllpack Legacy", "CPU", "CSR speedup"] = df["ChunkedEllpack Legacy", "CPU", "time"] / df["CSR", "CPU", "time"]
df["ChunkedEllpack Legacy", "GPU", "cuSparse speedup"] = df["ChunkedEllpack Legacy", "GPU", "time"] / df["cuSparse", "GPU", "time"]
df["Ellpack Legacy", "CPU", "CSR speedup"] = df["Ellpack Legacy", "CPU", "time"] / df["CSR", "CPU", "time"]
......@@ -87,22 +102,25 @@ df["SlicedEllpack", "CPU", "CSR speedup"] = df["SlicedEllpack",
df["SlicedEllpack", "GPU", "cuSparse speedup"] = df["SlicedEllpack", "GPU", "time"] / df["cuSparse", "GPU", "time"]
# Add speedup compared to legacy formats
df["CSR", "GPU", "Legacy speedup"] = df["CSR", "GPU", "time"] / df["CSR Legacy", "GPU", "time"]
df["CSR", "CPU", "Legacy speedup"] = df["CSR", "CPU", "time"] / df["CSR Legacy", "CPU", "time"]
df["CSR", "GPU", "Legacy speedup"] = df["CSR", "GPU", "time"] / df["CSR Legacy Scalar", "GPU", "time"]
df["CSR", "CPU", "Legacy speedup"] = df["CSR", "CPU", "time"] / df["CSR Legacy Scalar", "CPU", "time"]
df["Ellpack", "GPU", "Legacy speedup"] = df["Ellpack", "GPU", "time"] / df["Ellpack Legacy", "GPU", "time"]
df["Ellpack", "CPU", "Legacy speedup"] = df["Ellpack", "CPU", "time"] / df["Ellpack Legacy", "CPU", "time"]
df["SlicedEllpack", "GPU", "Legacy speedup"] = df["SlicedEllpack", "GPU", "time"] / df["SlicedEllpack Legacy", "GPU", "time"]
df["SlicedEllpack", "CPU", "Legacy speedup"] = df["SlicedEllpack", "CPU", "time"] / df["SlicedEllpack Legacy", "CPU", "time"]
df["BiEllpack", "GPU", "Legacy speedup"] = df["BiEllpack", "GPU", "time"] / df["BiEllpack Legacy", "GPU", "time"]
df["BiEllpack", "CPU", "Legacy speedup"] = df["BiEllpack", "CPU", "time"] / df["BiEllpack Legacy", "CPU", "time"]
print( "Exporting data frame to log.html..." )
pandas.options.display.float_format = '{:,.4f}'.format
df.to_html("log.html")
#print( "Exporting data frame to log.html..." )
#pandas.options.display.float_format = '{:,.4f}'.format
#df.to_html("log.html")
# extract columns of reference formats on GPU
print( "Preparing data for graph analysis..." )
df['cuSparse-bandwidth']=df['cuSparse','GPU','bandwidth']
df['ellpack-bandwidth']=df['Ellpack','GPU','bandwidth']
df['sliced-ellpack-bandwidth']=df['SlicedEllpack','GPU','bandwidth']
df['bi-ellpack-bandwidth']=df['BiEllpack','GPU','bandwidth']
# sort by cuSparse
df.sort_values(by=["cuSparse-bandwidth"],inplace=True,ascending=False)
......@@ -125,6 +143,12 @@ df.sort_values(by=["sliced-ellpack-bandwidth"],inplace=True,ascending=False)
sliced_ellpack_gpu_list = df["SlicedEllpack", "GPU", "bandwidth"].tolist();
sliced_ellpack_legacy_gpu_list = df["SlicedEllpack Legacy", "GPU", "bandwidth"].tolist();
# sort by BiEllpack
df.sort_values(by=["bi-ellpack-bandwidth"],inplace=True,ascending=False)
df.sort_values(by=["bi-ellpack-bandwidth"],inplace=True,ascending=False)
bi_ellpack_gpu_list = df["BiEllpack", "GPU", "bandwidth"].tolist();
bi_ellpack_legacy_gpu_list = df["BiEllpack Legacy", "GPU", "bandwidth"].tolist();
print( "Writing gnuplot files..." )
cuSparse_file = open( "cusparse.gplt", "w" )
......@@ -155,7 +179,16 @@ for x in sliced_ellpack_gpu_list:
if str( sliced_ellpack_legacy_gpu_list[ i ] ) != "nan":
sliced_ellpack_file.write( f"{i+1} {x} {sliced_ellpack_legacy_gpu_list[ i ]}\n" )
i = i + 1
ellpack_file.close()
sliced_ellpack_file.close()
bi_ellpack_file = open( "bi-ellpack.gplt", "w" )
i = 0;
for x in bi_ellpack_gpu_list:
if str( x ) != "nan":
if str( bi_ellpack_legacy_gpu_list[ i ] ) != "nan":
bi_ellpack_file.write( f"{i+1} {x} {bi_ellpack_legacy_gpu_list[ i ]}\n" )
i = i + 1
bi_ellpack_file.close()
print( "Generating Gnuplot file..." )
......@@ -179,18 +212,21 @@ gnuplot_file.write( " 'cusparse.gplt' using 1:5 title 'Sliced Ellpack' with
gnuplot_file.write( " 'cusparse.gplt' using 1:6 title 'Sliced Ellpack Legacy' with dots linewidth 2 lt rgb 'blue'\n" )
gnuplot_file.write( "set output 'chunked-ellpack-vs-cusparse.eps'\n" )
gnuplot_file.write( "plot 'cusparse.gplt' using 1:2 title 'cuSparse' with lines linewidth 2 lt rgb 'red', \\\n" )
#gnuplot_file.write( " 'cusparse.gplt' using 1:7 title 'Chunked Ellpack' with dots linewidth 2 lt rgb 'green',\\\n" )
gnuplot_file.write( " 'cusparse.gplt' using 1:7 title 'Chunked Ellpack' with dots linewidth 2 lt rgb 'green',\\\n" )
gnuplot_file.write( " 'cusparse.gplt' using 1:7 title 'Chunked Ellpack Legacy' with dots linewidth 2 lt rgb 'blue'\n" )
gnuplot_file.write( "set output 'bi-ellpack-vs-cusparse.eps'\n" )
gnuplot_file.write( "plot 'cusparse.gplt' using 1:2 title 'cuSparse' with lines linewidth 2 lt rgb 'red', \\\n" )
#gnuplot_file.write( " 'cusparse.gplt' using 1:7 title 'BiEllpack' with dots linewidth 2 lt rgb 'green',\\\n" )
gnuplot_file.write( " 'cusparse.gplt' using 1:7 title 'BiEllpack' with dots linewidth 2 lt rgb 'green',\\\n" )
gnuplot_file.write( " 'cusparse.gplt' using 1:8 title 'BiEllpack Legacy' with dots linewidth 2 lt rgb 'blue'\n" )
gnuplot_file.write( "set output 'ellpack-vs-ellpack-legacy.eps'\n" )
gnuplot_file.write( "plot 'ellpack.gplt' using 1:2 title 'Ellpack' with lines linewidth 2 lt rgb 'red', \\\n" )
gnuplot_file.write( " 'ellpack.gplt' using 1:3 title 'Ellpack Legacy' with dots linewidth 2 lt rgb 'blue'\n" )
gnuplot_file.write( "set output 'sliced-ellpack-vs-sliced-ellpack-legacy.eps'\n" )
gnuplot_file.write( "plot 'ellpack.gplt' using 1:2 title 'Ellpack' with lines linewidth 2 lt rgb 'red', \\\n" )
gnuplot_file.write( " 'ellpack.gplt' using 1:3 title 'Ellpack Legacy' with dots linewidth 2 lt rgb 'blue'\n" )
gnuplot_file.write( "plot 'sliced-ellpack.gplt' using 1:2 title 'SlicedEllpack' with lines linewidth 2 lt rgb 'red', \\\n" )
gnuplot_file.write( " 'sliced-ellpack.gplt' using 1:3 title 'SlicedEllpack Legacy' with dots linewidth 2 lt rgb 'blue'\n" )
gnuplot_file.write( "set output 'bi-ellpack-vs-bi-ellpack-legacy.eps'\n" )
gnuplot_file.write( "plot 'bi-ellpack.gplt' using 1:2 title 'BiEllpack' with lines linewidth 2 lt rgb 'red', \\\n" )
gnuplot_file.write( " 'bi-ellpack.gplt' using 1:3 title 'BiEllpack Legacy' with dots linewidth 2 lt rgb 'blue'\n" )
gnuplot_file.close()
print( "Executing Gnuplot ..." )
......@@ -203,6 +239,7 @@ os.system( "epstopdf --autorotate All chunked-ellpack-vs-cusparse.eps" )
os.system( "epstopdf --autorotate All bi-ellpack-vs-cusparse.eps" )
os.system( "epstopdf --autorotate All ellpack-vs-ellpack-legacy.eps" )
os.system( "epstopdf --autorotate All sliced-ellpack-vs-sliced-ellpack-legacy.eps" )
os.system( "epstopdf --autorotate All bi-ellpack-vs-bi-ellpack-legacy.eps" )
print( "Deleting temprary files..." )
os.system( "rm cusparse.gplt" )
......
......@@ -24,7 +24,7 @@
#include <TNL/Operators/Operator.h>
#include <TNL/Functions/Analytic/Constant.h>
#include <TNL/Functions/FunctionAdapter.h>
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/MeshFunctionView.h>
namespace TNL {
namespace Operators {
......
......@@ -24,7 +24,7 @@
#include <TNL/Operators/Operator.h>
#include <TNL/Functions/Analytic/Constant.h>
#include <TNL/Functions/FunctionAdapter.h>
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/MeshFunctionView.h>
namespace TNL {
namespace Operators {
......
......@@ -19,7 +19,7 @@ class BoundaryConditionsBoiler
typedef Real RealType;
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;
typedef typename Mesh::DeviceType DeviceType;
typedef TNL::Operators::DensityBoundaryConditionsBoiler< MeshType, FunctionType, RealType, IndexType > DensityBoundaryConditionsType;
......
......@@ -19,7 +19,7 @@ class BoundaryConditionsCavity
typedef Real RealType;
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;
typedef typename Mesh::DeviceType DeviceType;
typedef TNL::Operators::DensityBoundaryConditionsCavity< MeshType, FunctionType, RealType, IndexType > DensityBoundaryConditionsType;
......
......@@ -11,7 +11,7 @@
#pragma once
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/MeshFunctionView.h>
#include <TNL/Functions/VectorField.h>
#include <TNL/Pointers/SharedPointer.h>
......@@ -26,7 +26,7 @@ class CompressibleConservativeVariables
typedef typename MeshType::RealType RealType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::IndexType IndexType;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshType > MeshPointer;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
......@@ -50,7 +50,7 @@ class CompressibleConservativeVariables
template< typename Vector >
void bind( const MeshPointer& meshPointer,
const Vector& data,
Vector& data,
IndexType offset = 0 )
{
IndexType currentOffset( offset );
......
......@@ -107,7 +107,7 @@ class DensityBoundaryConditionsBoiler< Meshes::Grid< 1, MeshReal, Device, MeshIn
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -229,7 +229,7 @@ class DensityBoundaryConditionsBoiler< Meshes::Grid< 2, MeshReal, Device, MeshIn
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -378,7 +378,7 @@ class DensityBoundaryConditionsBoiler< Meshes::Grid< 3, MeshReal, Device, MeshIn
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -107,7 +107,7 @@ class DensityBoundaryConditionsCavity< Meshes::Grid< 1, MeshReal, Device, MeshIn
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -229,7 +229,7 @@ class DensityBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, MeshIn
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -375,7 +375,7 @@ class DensityBoundaryConditionsCavity< Meshes::Grid< 3, MeshReal, Device, MeshIn
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -109,7 +109,7 @@ class EnergyBoundaryConditionsBoiler< Meshes::Grid< 1, MeshReal, Device, MeshInd
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -247,7 +247,7 @@ class EnergyBoundaryConditionsBoiler< Meshes::Grid< 2, MeshReal, Device, MeshInd
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -526,7 +526,7 @@ class EnergyBoundaryConditionsBoiler< Meshes::Grid< 3, MeshReal, Device, MeshInd
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -109,7 +109,7 @@ class EnergyBoundaryConditionsCavity< Meshes::Grid< 1, MeshReal, Device, MeshInd
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -247,7 +247,7 @@ class EnergyBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, MeshInd
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -470,7 +470,7 @@ class EnergyBoundaryConditionsCavity< Meshes::Grid< 3, MeshReal, Device, MeshInd
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -33,7 +33,7 @@ class LaxFridrichs
typedef Real RealType;
typedef typename Mesh::DeviceType DeviceType;
typedef Index IndexType;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;
static const int Dimensions = Mesh::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VectorFieldType;
......
......@@ -31,7 +31,7 @@ class LaxFridrichsContinuityBase
typedef Mesh MeshType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::CoordinatesType CoordinatesType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< VelocityFieldType > VelocityFieldPointer;
......
......@@ -27,7 +27,7 @@ class LaxFridrichsEnergyBase
typedef Mesh MeshType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::CoordinatesType CoordinatesType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
......
......@@ -25,7 +25,7 @@ class LaxFridrichsMomentumBase
typedef Mesh MeshType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::CoordinatesType CoordinatesType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
......
......@@ -107,7 +107,7 @@ class MomentumXBoundaryConditionsBoiler< Meshes::Grid< 1, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -237,7 +237,7 @@ class MomentumXBoundaryConditionsBoiler< Meshes::Grid< 2, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -412,7 +412,7 @@ class MomentumXBoundaryConditionsBoiler< Meshes::Grid< 3, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -107,7 +107,7 @@ class MomentumXBoundaryConditionsCavity< Meshes::Grid< 1, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -237,7 +237,7 @@ class MomentumXBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -401,7 +401,7 @@ class MomentumXBoundaryConditionsCavity< Meshes::Grid< 3, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -107,7 +107,7 @@ class MomentumYBoundaryConditionsBoiler< Meshes::Grid< 1, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -237,7 +237,7 @@ class MomentumYBoundaryConditionsBoiler< Meshes::Grid< 2, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -407,7 +407,7 @@ class MomentumYBoundaryConditionsBoiler< Meshes::Grid< 3, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -107,7 +107,7 @@ class MomentumYBoundaryConditionsCavity< Meshes::Grid< 1, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -237,7 +237,7 @@ class MomentumYBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -398,7 +398,7 @@ class MomentumYBoundaryConditionsCavity< Meshes::Grid< 3, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -107,7 +107,7 @@ class MomentumZBoundaryConditionsBoiler< Meshes::Grid< 1, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -237,7 +237,7 @@ class MomentumZBoundaryConditionsBoiler< Meshes::Grid< 2, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -388,7 +388,7 @@ class MomentumZBoundaryConditionsBoiler< Meshes::Grid< 3, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -107,7 +107,7 @@ class MomentumZBoundaryConditionsCavity< Meshes::Grid< 1, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 1, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -237,7 +237,7 @@ class MomentumZBoundaryConditionsCavity< Meshes::Grid< 2, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 2, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......@@ -388,7 +388,7 @@ class MomentumZBoundaryConditionsCavity< Meshes::Grid< 3, MeshReal, Device, Mesh
typedef Index IndexType;
typedef Function FunctionType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
typedef Containers::StaticVector< 3, RealType > PointType;
typedef typename MeshType::CoordinatesType CoordinatesType;
......
......@@ -11,7 +11,7 @@
#pragma once
#include <TNL/Pointers/SharedPointer.h>
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/MeshFunctionView.h>
#include <TNL/Functions/VectorField.h>
#include <TNL/Functions/MeshFunctionEvaluator.h>
#include "CompressibleConservativeVariables.h"
......@@ -29,7 +29,7 @@ class PhysicalVariablesGetter
typedef typename MeshType::IndexType IndexType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef CompressibleConservativeVariables< MeshType > ConservativeVariablesType;
typedef Pointers::SharedPointer< ConservativeVariablesType > ConservativeVariablesPointer;
......
......@@ -37,7 +37,7 @@ class RiemannProblemInitialConditionSetter< Meshes::Grid< 1,MeshReal, Device, Me
typedef typename MeshType::IndexType IndexType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Containers::StaticVector< Dimensions, RealType > PointType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
// for cyklus i = 0 to mesh.getDimensions().x() j pro .y() a k pro .z()
......@@ -194,7 +194,7 @@ class RiemannProblemInitialConditionSetter< Meshes::Grid< 2, MeshReal, Device, M
typedef typename MeshType::IndexType IndexType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Containers::StaticVector< Dimensions, RealType > PointType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
// for cyklus i = 0 to mesh.getDimensions().x() j pro .y() a k pro .z()
......@@ -414,7 +414,7 @@ class RiemannProblemInitialConditionSetter< Meshes::Grid< 3, MeshReal, Device, M
typedef typename MeshType::IndexType IndexType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Containers::StaticVector< Dimensions, RealType > PointType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
// for cyklus i = 0 to mesh.getDimensions().x() j pro .y() a k pro .z()
......@@ -767,7 +767,7 @@ class RiemannProblemInitialCondition
typedef typename MeshType::IndexType IndexType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Containers::StaticVector< Dimensions, RealType > PointType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef Functions::VectorField< Dimensions, MeshType > VectorFieldType;
......
......@@ -33,7 +33,7 @@ class Upwind
typedef Real RealType;
typedef typename Mesh::DeviceType DeviceType;
typedef Index IndexType;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;
static const int Dimensions = Mesh::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VectorFieldType;
......
......@@ -31,7 +31,7 @@ class UpwindContinuityBase
typedef Mesh MeshType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::CoordinatesType CoordinatesType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
......
......@@ -27,7 +27,7 @@ class UpwindEnergyBase
typedef Mesh MeshType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::CoordinatesType CoordinatesType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
......
......@@ -25,7 +25,7 @@ class UpwindMomentumBase
typedef Mesh MeshType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::CoordinatesType CoordinatesType;
typedef Functions::MeshFunction< MeshType > MeshFunctionType;
typedef Functions::MeshFunctionView< MeshType > MeshFunctionType;
static const int Dimensions = MeshType::getMeshDimension();
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
......
......@@ -11,7 +11,7 @@
#pragma once
#include <TNL/Problems/PDEProblem.h>
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/MeshFunctionView.h>
#include <TNL/Exceptions/NotImplementedError.h>
#include "CompressibleConservativeVariables.h"
......@@ -45,7 +45,7 @@ class navierStokesProblem:
using typename BaseType::DofVectorPointer;
static const int Dimensions = Mesh::getMeshDimension();
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;