From 1dbe4587cf9293f74be7291f859c888a0142b734 Mon Sep 17 00:00:00 2001 From: Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz> Date: Thu, 10 Sep 2015 20:09:40 +0200 Subject: [PATCH] Renaming Ellpack graph to Ellpack network. --- src/CMakeLists.txt | 2 +- src/graphs/tnlEllpackGraph_impl.h | 78 ---- src/{graphs => networks}/CMakeLists.txt | 8 +- .../tnlEllpackNetwork.h} | 42 ++- .../tnlEllpackNetworkPorts.h} | 40 +- .../tnlEllpackNetworkPorts_impl.h} | 44 +-- src/networks/tnlEllpackNetwork_impl.h | 99 +++++ tests/unit-tests/CMakeLists.txt | 2 +- .../unit-tests/graphs/tnlEllpackGraphTester.h | 24 -- .../{graphs => networks}/CMakeLists.txt | 0 .../tnlEllpackNetworkTest.cpp} | 13 +- .../tnlSparseNetworkTester.h} | 342 +++++++++--------- 12 files changed, 349 insertions(+), 345 deletions(-) delete mode 100644 src/graphs/tnlEllpackGraph_impl.h rename src/{graphs => networks}/CMakeLists.txt (75%) rename src/{graphs/tnlEllpackGraph.h => networks/tnlEllpackNetwork.h} (59%) rename src/{graphs/tnlEllpackGraphLinksAccessor.h => networks/tnlEllpackNetworkPorts.h} (51%) rename src/{graphs/tnlEllpackGraphLinksAccessor_impl.h => networks/tnlEllpackNetworkPorts_impl.h} (57%) create mode 100644 src/networks/tnlEllpackNetwork_impl.h delete mode 100644 tests/unit-tests/graphs/tnlEllpackGraphTester.h rename tests/unit-tests/{graphs => networks}/CMakeLists.txt (100%) rename tests/unit-tests/{graphs/tnlEllpackGraphTest.cpp => networks/tnlEllpackNetworkTest.cpp} (67%) rename tests/unit-tests/{graphs/tnlSparseGraphTester.h => networks/tnlSparseNetworkTester.h} (78%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3453c910e8..b14008b81a 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,9 +3,9 @@ ADD_SUBDIRECTORY( functors ) ADD_SUBDIRECTORY( config ) ADD_SUBDIRECTORY( core ) ADD_SUBDIRECTORY( debug ) -ADD_SUBDIRECTORY( graphs ) ADD_SUBDIRECTORY( matrices ) ADD_SUBDIRECTORY( mesh ) +ADD_SUBDIRECTORY( networks ) ADD_SUBDIRECTORY( operators ) ADD_SUBDIRECTORY( problems ) ADD_SUBDIRECTORY( solvers ) diff --git a/src/graphs/tnlEllpackGraph_impl.h b/src/graphs/tnlEllpackGraph_impl.h deleted file mode 100644 index 09fa5c4020..0000000000 --- a/src/graphs/tnlEllpackGraph_impl.h +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************** - tnlEllpackGraph_impl.h - description - ------------------- - begin : Sep 9, 2015 - copyright : (C) 2015 by Tomas Oberhuber et al. - email : tomas.oberhuber@fjfi.cvut.cz - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef TNLELLPACKGRAPH_IMPL_H -#define TNLELLPACKGRAPH_IMPL_H - -#include "tnlEllpackGraph.h" - - -template< typename Device, - typename Index > -tnlEllpackGraph< Device, Index >:: -tnlEllpackGraph() -: maxLinksPerNode( 0 ), numberOfNodes( 0 ) -{ -} - -template< typename Device, - typename Index > -void -tnlEllpackGraph< Device, Index >:: -setNumberOfNodes( const IndexType nodes ) -{ - this->numberOfNodes = nodes; -} - -template< typename Device, - typename Index > -void -tnlEllpackGraph< Device, Index >:: -setNumberOfLinksPerNode( const LinksPerNodesVectorType& linksPerNode ) -{ - tnlAssert( linksPerNode.getSize() == this->numberOfNodes, - cerr << "linksPerNode.getSize() = " << linksPerNode.getSize() - << "this->numberOfNodes = " << this->numberOfNodes ); - this->maxLinksPerNode = linksPerNode.max(); - - tnlAssert( this->maxLinksPerNode >= 0, - cerr << "this->maxLinksPerNode = " << this->maxLinksPerNode ); -} - -template< typename Device, - typename Index > -typename tnlEllpackGraph< Device, Index >::LinksAccessorType -tnlEllpackGraph< Device, Index >:: -getNodeLinksAccessor( const IndexType& nodeIndex ) -{ - return LinksAccessorType( this->links.getData(), nodeIndex, this->maxLinksPerNode ); -} - -template< typename Device, - typename Index > -typename tnlEllpackGraph< Device, Index >::ConstLinksAccessorType -tnlEllpackGraph< Device, Index >:: -getNodeLinksAccessor( const IndexType& nodeIndex ) const -{ - return ConstLinksAccessorType( this->links.getData(), nodeIndex, this->maxLinksPerNode ); -} - - - - -#endif /* TNLELLPACKGRAPH_IMPL_H */ - diff --git a/src/graphs/CMakeLists.txt b/src/networks/CMakeLists.txt similarity index 75% rename from src/graphs/CMakeLists.txt rename to src/networks/CMakeLists.txt index 2ff0b5d8f9..aba72b81f5 100644 --- a/src/graphs/CMakeLists.txt +++ b/src/networks/CMakeLists.txt @@ -3,18 +3,18 @@ SET( headers tnlEllpackGraph.h tnlEllpackGraphLinksAccessor.h tnlEllpackGraphLinksAccessor_impl.h ) -SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/graphs ) +SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/networks ) set( common_SOURCES ) IF( BUILD_CUDA ) - set( tnl_graphs_CUDA__SOURCES + set( tnl_networks_CUDA__SOURCES ${common_SOURCES} PARENT_SCOPE ) ENDIF() -set( tnl_graphs_SOURCES +set( tnl_networks_SOURCES ${common_SOURCES} PARENT_SCOPE ) -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/graphs ) \ No newline at end of file +INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/networks ) \ No newline at end of file diff --git a/src/graphs/tnlEllpackGraph.h b/src/networks/tnlEllpackNetwork.h similarity index 59% rename from src/graphs/tnlEllpackGraph.h rename to src/networks/tnlEllpackNetwork.h index f24841480e..9dae8599af 100644 --- a/src/graphs/tnlEllpackGraph.h +++ b/src/networks/tnlEllpackNetwork.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlEllpackGraph.h - description + tnlEllpackNetwork.h - description ------------------- begin : Sep 9, 2015 copyright : (C) 2015 by Tomas Oberhuber et al. @@ -15,44 +15,50 @@ * * ***************************************************************************/ -#ifndef TNLELLPACKGRAPH_H -#define TNLELLPACKGRAPH_H +#ifndef TNLELLPACKNETWORK_H +#define TNLELLPACKNETWORK_H -#include <graphs/sparse/tnlEllpackGraphLinksAccessor.h> +#include <networks/tnlEllpackNetworkPorts.h> template< typename Device = tnlHost, typename Index = int > -class tnlEllpackGraphConstLinksAccessor; +class tnlEllpackNetworkConstPorts; template< typename Device = tnlHost, typename Index = int > -class tnlEllpackGraph +class tnlEllpackNetwork { public: - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlEllpackGraphLinksAccessor< DeviceType, IndexType > LinksAccessorType; - typedef tnlEllpackGraphConstLinksAccessor< DeviceType, IndexType > ConstLinksAccessorType; - typedef tnlVector< IndexType, DeviceType, IndexType > LinksPerNodesVectorType; + typedef Device DeviceType; + typedef Index IndexType; + typedef tnlEllpackNetworkPorts< DeviceType, IndexType > PortsType; + typedef tnlEllpackNetworkConstPorts< DeviceType, IndexType > ConstPortsType; + typedef tnlVector< IndexType, DeviceType, IndexType > PortsAllocationVectorType; - tnlEllpackGraph(); + tnlEllpackNetwork(); - void setNumberOfNodes( const IndexType nodes ); + void setDimensions( const IndexType inputs, + const IndexType outputs ); - void setNumberOfLinksPerNode( const LinksPerNodesVectorType& linksPerNode ); + const IndexType getInputsCount() const; - LinksAccessorType getNodeLinksAccessor( const IndexType& nodeIndex ); + const IndexType getOutputsCount() const; - ConstLinksAccessorType getNodeLinksAccessor( const IndexType& nodeIndex ) const; + void allocatePorts( const PortsAllocationVectorType& portsCount ); + + PortsType getPorts( const IndexType& inputIndex ); + + ConstPortsType getPorts( const IndexType& inputIndex ) const; protected: tnlVector< IndexType, DeviceType, IndexType > links; - IndexType maxLinksPerNode, numberOfNodes; + IndexType inputs, outputs, portsMaxCount; }; +#include <networks/tnlEllpackNetworks_impl.h> -#endif /* TNLELLPACKGRAPH_H */ +#endif /* TNLELLPACKNETWORK_H */ diff --git a/src/graphs/tnlEllpackGraphLinksAccessor.h b/src/networks/tnlEllpackNetworkPorts.h similarity index 51% rename from src/graphs/tnlEllpackGraphLinksAccessor.h rename to src/networks/tnlEllpackNetworkPorts.h index 03a1e87254..6ba99bb9f1 100644 --- a/src/graphs/tnlEllpackGraphLinksAccessor.h +++ b/src/networks/tnlEllpackNetworkPorts.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlEllpackGraph.h - description + tnlEllpackNetworkPorts.h - description ------------------- begin : Sep 10, 2015 copyright : (C) 2015 by Tomas Oberhuber et al. @@ -15,43 +15,43 @@ * * ***************************************************************************/ -#ifndef TNLELLPACKGRAPHLINKSACCESSOR_H -#define TNLELLPACKGRAPHLINKSACCESSOR_H +#ifndef TNLELLPACKNETWORKPORTS_H +#define TNLELLPACKNETWORKPORTS_H template< typename Device, typename Index > -class tnlEllpackGraphLinksAccessor +class tnlEllpackNetworkPorts { public: - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlEllpackGraph< DeviceType, IndexType > GraphType; + typedef Device DeviceType; + typedef Index IndexType; + typedef tnlEllpackNetwork< DeviceType, IndexType > NetworkType; - void setLink( const IndexType linkIndex, - const IndexType targetNode ); + void setOutput( const IndexType portIndex, + const IndexType output ); - IndexType getLinkTarget( const IndexType linkIndex ) const; + IndexType getOutput( const IndexType portIndex ) const; - IndexType& operator[]( const IndexType linkIndex ); + IndexType& operator[]( const IndexType portIndex ); - const IndexType& operator[]( const IndexType linkIndex ) const; + const IndexType& operator[]( const IndexType portIndex ) const; protected: - tnlEllpackGraphLinksAccessor( IndexType* graphLinks, - const IndexType node, - const maxLinksPerNode ); + tnlEllpackNetworkPorts( IndexType* ports, + const IndexType input, + const IndexType portsMaxCount ); - IndexType* links; + IndexType* ports; - IndexType step, maxLinksPerNode; + IndexType step; - friend tnlEllpackGraph< IndexType, DeviceType >; + friend tnlEllpackNetwork< IndexType, DeviceType >; }; -#include <graphs/sparse/tnlEllpackGraphLinksAccessor_impl.h> +#include <networks/tnlEllpackNetworkPorts_impl.h> -#endif /* TNLELLPACKGRAPHLINKSACCESSOR_H */ +#endif /* TNLELLPACKNETWORKPORTS_H */ diff --git a/src/graphs/tnlEllpackGraphLinksAccessor_impl.h b/src/networks/tnlEllpackNetworkPorts_impl.h similarity index 57% rename from src/graphs/tnlEllpackGraphLinksAccessor_impl.h rename to src/networks/tnlEllpackNetworkPorts_impl.h index b878805299..f0c5b5048b 100644 --- a/src/graphs/tnlEllpackGraphLinksAccessor_impl.h +++ b/src/networks/tnlEllpackNetworkPorts_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlEllpackGraph_impl.h - description + tnlEllpackNetworkPorts_impl.h - description ------------------- begin : Sep 10, 2015 copyright : (C) 2015 by Tomas Oberhuber et al. @@ -15,56 +15,56 @@ * * ***************************************************************************/ -#ifndef TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H -#define TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H +#ifndef TNLELLPACKNETWORKPORTS_IMPL_H +#define TNLELLPACKNETWORKPORTS_IMPL_H template< typename Device, typename Index > -tnlEllpackGraphLinksAccessor< Device, Index >:: -tnlEllpackGraphLinksAccessor( IndexType* graphLinks, - const IndexType node, - const IndexType maxLinksPerNode ) +tnlEllpackNetworkPorts< Device, Index >:: +tnlEllpackNetworkPorts( IndexType* networkPorts, + const IndexType input, + const IndexType portsMaxCount ) { - this->links = &graphLinks[ node * maxLinksPerNode ]; - this->maxLinksPerNode = maxLinksPerNode; + this->ports = &networkPorts[ input * portsMaxCount ]; + this->portsMaxCount = portsMaxCount; } template< typename Device, typename Index > void -tnlEllpackGraphLinksAccessor< Device, Index >:: -setLink( const IndexType linkIndex, - const IndexType targetNode ) +tnlEllpackNetworkPorts< Device, Index >:: +setOutput( const IndexType portIndex, + const IndexType output ) { - links[ linkIndex ] = targetNode; + this->ports[ portIndex ] = ouput; } template< typename Device, typename Index > Index -tnlEllpackGraphLinksAccessor< Device, Index >:: -getLinkTarget( const IndexType linkIndex ) const +tnlEllpackNetworkPorts< Device, Index >:: +getOutput( const IndexType portIndex ) const { - return links[ linkIndex ]; + return this->ports[ portIndex ]; } template< typename Device, typename Index > Index& -tnlEllpackGraphLinksAccessor< Device, Index >:: -operator[]( const IndexType linkIndex ) +tnlEllpackNetworkPorts< Device, Index >:: +operator[]( const IndexType portIndex ) { - return links[ linkIndex ]; + return this->ports[ portIndex ]; } template< typename Device, typename Index > const Index& -tnlEllpackGraphLinksAccessor< Device, Index >:: -operator[]( const IndexType linkIndex ) const +tnlEllpackNetworkPorts< Device, Index >:: +operator[]( const IndexType portIndex ) const { - return links[ linkIndex ]; + return this->ports[ portIndex ]; } diff --git a/src/networks/tnlEllpackNetwork_impl.h b/src/networks/tnlEllpackNetwork_impl.h new file mode 100644 index 0000000000..4d73559f03 --- /dev/null +++ b/src/networks/tnlEllpackNetwork_impl.h @@ -0,0 +1,99 @@ +/*************************************************************************** + tnlEllpackNetwork_impl.h - description + ------------------- + begin : Sep 9, 2015 + copyright : (C) 2015 by Tomas Oberhuber et al. + email : tomas.oberhuber@fjfi.cvut.cz + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TNLELLPACKNETWORK_IMPL_H +#define TNLELLPACKNETWORK_IMPL_H + +#include <networks/tnlEllpackNetwork.h> + + +template< typename Device, + typename Index > +tnlEllpackNetwork< Device, Index >:: +tnlEllpackNetwork() +: inputs( 0 ), outputs( 0 ), portsMaxCount( 0 ) +{ +} + +template< typename Device, + typename Index > +void +tnlEllpackNetwork< Device, Index >:: +setDimensions( const IndexType inputs, + const IndexType outputs ) +{ + this->inputs = inputs; + this->outputs = outputs; +} + +template< typename Device, + typename Index > +const Index +tnlEllpackNetwork< Device, Index >:: +getInputsCount() const +{ + return this->inputs; +} + +template< typename Device, + typename Index > +const Index +tnlEllpackNetwork< Device, Index >:: +getOutputsCount() const +{ + return this->outputs; +} + +template< typename Device, + typename Index > +void +tnlEllpackNetwork< Device, Index >:: +allocatePorts( const PortsAllocationVectorType& portsCount ) +{ + tnlAssert( portsCount.getSize() == this->inputs, + cerr << "portsCount.getSize() = " << portsCount.getSize() + << "this->inputs = " << this->inputs ); + this->portsMaxCount = portsCount.max(); + + tnlAssert( this->portsMaxCount >= 0 && this->portsMaxCount <= this->outputs, + cerr << "this->portsMaxCount = " << this->portsMaxCount + << " this->outputs = " << this->outputs ); +} + +template< typename Device, + typename Index > +typename tnlEllpackNetwork< Device, Index >::LinksAccessorType +tnlEllpackNetwork< Device, Index >:: +getPorts( const IndexType& inputIndex ) +{ + return PortsType( this->links.getData(), inputIndex, this->portsMaxCount ); +} + +template< typename Device, + typename Index > +typename tnlEllpackNetwork< Device, Index >::ConstLinksAccessorType +tnlEllpackNetwork< Device, Index >:: +getPorts( const IndexType& inputIndex ) const +{ + return ConstPortsType( this->links.getData(), inputIndex, this->portsMaxCount ); +} + + + + +#endif /* TNLELLPACKGRAPH_IMPL_H */ + diff --git a/tests/unit-tests/CMakeLists.txt b/tests/unit-tests/CMakeLists.txt index 3acb177127..9455c1f71c 100755 --- a/tests/unit-tests/CMakeLists.txt +++ b/tests/unit-tests/CMakeLists.txt @@ -1,5 +1,5 @@ ADD_SUBDIRECTORY( core ) -ADD_SUBDIRECTORY( graphs ) +ADD_SUBDIRECTORY( networks ) ADD_SUBDIRECTORY( matrices ) ADD_SUBDIRECTORY( mesh ) ADD_SUBDIRECTORY( operators ) diff --git a/tests/unit-tests/graphs/tnlEllpackGraphTester.h b/tests/unit-tests/graphs/tnlEllpackGraphTester.h deleted file mode 100644 index 5ab2576056..0000000000 --- a/tests/unit-tests/graphs/tnlEllpackGraphTester.h +++ /dev/null @@ -1,24 +0,0 @@ -/*************************************************************************** - tnlEllpackGraphTester.h - description - ------------------- - begin : Sep 10, 2015 - copyright : (C) 2015 by Tomas Oberhuber et al. - email : tomas.oberhuber@fjfi.cvut.cz - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef TNLELLPACKGRAPHTESTER_H -#define TNLELLPACKGRAPHTESTER_H - - - -#endif /* TNLELLPACKGRAPHTESTER_H */ - diff --git a/tests/unit-tests/graphs/CMakeLists.txt b/tests/unit-tests/networks/CMakeLists.txt similarity index 100% rename from tests/unit-tests/graphs/CMakeLists.txt rename to tests/unit-tests/networks/CMakeLists.txt diff --git a/tests/unit-tests/graphs/tnlEllpackGraphTest.cpp b/tests/unit-tests/networks/tnlEllpackNetworkTest.cpp similarity index 67% rename from tests/unit-tests/graphs/tnlEllpackGraphTest.cpp rename to tests/unit-tests/networks/tnlEllpackNetworkTest.cpp index 7a986b2a00..821185502e 100644 --- a/tests/unit-tests/graphs/tnlEllpackGraphTest.cpp +++ b/tests/unit-tests/networks/tnlEllpackNetworkTest.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - tnlEllpackGraphTest.cpp - description + tnlEllpackNetworkTest.cpp - description ------------------- begin : Sep 10, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -19,16 +19,17 @@ #include <core/tnlHost.h> #include <cstdlib> -#include "graphs/tnlEllpackGraph.h" +#include "networks/tnlEllpackNetwork.h" +#include "networks/tnlSparseNetworkTester.h" #include "../tnlUnitTestStarter.h" int main( int argc, char* argv[] ) { #ifdef HAVE_CPPUNIT - if( ! tnlUnitTestStarter :: run< tnlSparseMatrixTester< tnlEllpackMatrix< float, tnlHost, int > > >() || - ! tnlUnitTestStarter :: run< tnlSparseMatrixTester< tnlEllpackMatrix< double, tnlHost, int > > >() || - ! tnlUnitTestStarter :: run< tnlSparseMatrixTester< tnlEllpackMatrix< float, tnlHost, long int > > >() || - ! tnlUnitTestStarter :: run< tnlSparseMatrixTester< tnlEllpackMatrix< double, tnlHost, long int > > >() + if( ! tnlUnitTestStarter :: run< tnlSparseNetworkTester< tnlEllpackNetwork< float, tnlHost, int > > >() || + ! tnlUnitTestStarter :: run< tnlSparseNetworkTester< tnlEllpackNetwork< double, tnlHost, int > > >() || + ! tnlUnitTestStarter :: run< tnlSparseNetworkTester< tnlEllpackNetwork< float, tnlHost, long int > > >() || + ! tnlUnitTestStarter :: run< tnlSparseNetworkTester< tnlEllpackNetwork< double, tnlHost, long int > > >() ) return EXIT_FAILURE; return EXIT_SUCCESS; diff --git a/tests/unit-tests/graphs/tnlSparseGraphTester.h b/tests/unit-tests/networks/tnlSparseNetworkTester.h similarity index 78% rename from tests/unit-tests/graphs/tnlSparseGraphTester.h rename to tests/unit-tests/networks/tnlSparseNetworkTester.h index bb6fc235c3..141cba58bb 100644 --- a/tests/unit-tests/graphs/tnlSparseGraphTester.h +++ b/tests/unit-tests/networks/tnlSparseNetworkTester.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlSparseGraphTester.h - description + tnlSparseNetworkTester.h - description ------------------- begin : Sep 10, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -15,16 +15,16 @@ * * ***************************************************************************/ -#ifndef TNLSPARSEGRAPHTESTER_H_ -#define TNLSPARSEGRAPHTESTER_H_ +#ifndef TNLSPARSENETWORKTESTER_H_ +#define TNLSPARSENETWORKTESTER_H_ -template< typename Graph, +template< typename Network, typename TestSetup > -class tnlSparseGraphTesterGraphSetter +class tnlSparseNetworkTesterNetworkSetter { public: - static bool setup( Graph& graph ) + static bool setup( Network& graph ) { return true; } @@ -40,74 +40,74 @@ class tnlSparseGraphTesterGraphSetter #include <core/vectors/tnlVector.h> #ifdef HAVE_CUDA -template< typename GraphType > -__global__ void tnlSparseGraphTester__setElementFastTestCudaKernel( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setElementFastTestCudaKernel( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setElementFast_DiagonalGraphTestCudaKernel( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setElementFast_DiagonalNetworkTestCudaKernel( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setElementFast_DenseGraphTestCudaKernel1( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setElementFast_DenseNetworkTestCudaKernel1( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setElementFast_DenseGraphTestCudaKernel2( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setElementFast_DenseNetworkTestCudaKernel2( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setElementFast_LowerTriangularGraphTestCudaKernel1( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setElementFast_LowerTriangularNetworkTestCudaKernel1( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setElementFast_LowerTriangularGraphTestCudaKernel2( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setElementFast_LowerTriangularNetworkTestCudaKernel2( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setRowFast_DiagonalGraphTestCudaKernel( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setRowFast_DiagonalNetworkTestCudaKernel( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setRowFast_DenseGraphTestCudaKernel1( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setRowFast_DenseNetworkTestCudaKernel1( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setRowFast_DenseGraphTestCudaKernel2( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setRowFast_DenseNetworkTestCudaKernel2( NetworkType* graph, bool* testResult ); -template< typename GraphType > -__global__ void tnlSparseGraphTester__setRowFast_LowerTriangularGraphTestCudaKernel( GraphType* graph, +template< typename NetworkType > +__global__ void tnlSparseNetworkTester__setRowFast_LowerTriangularNetworkTestCudaKernel( NetworkType* graph, bool* testResult ); #endif -class tnlSparseGraphTestDefaultSetup +class tnlSparseNetworkTestDefaultSetup {}; -template< typename Graph, - typename GraphSetup = tnlSparseGraphTestDefaultSetup > -class tnlSparseGraphTester : public CppUnit :: TestCase +template< typename Network, + typename NetworkSetup = tnlSparseNetworkTestDefaultSetup > +class tnlSparseNetworkTester : public CppUnit :: TestCase { public: - typedef Graph GraphType; - typedef typename Graph::RealType RealType; - typedef typename Graph::DeviceType DeviceType; - typedef typename Graph::IndexType IndexType; - typedef tnlVector< RealType, DeviceType, IndexType > VectorType; - typedef tnlVector< IndexType, DeviceType, IndexType > IndexVector; - typedef tnlSparseGraphTester< GraphType, GraphSetup > TesterType; - typedef tnlSparseGraphTesterGraphSetter< GraphType, GraphSetup > GraphSetter; - typedef typename CppUnit::TestCaller< TesterType > TestCallerType; - - tnlSparseGraphTester(){}; + typedef Network NetworkType; + typedef typename Network::RealType RealType; + typedef typename Network::DeviceType DeviceType; + typedef typename Network::IndexType IndexType; + typedef tnlVector< RealType, DeviceType, IndexType > VectorType; + typedef tnlVector< IndexType, DeviceType, IndexType > IndexVector; + typedef tnlSparseNetworkTester< NetworkType, NetworkSetup > TesterType; + typedef tnlSparseNetworkTesterNetworkSetter< NetworkType, NetworkSetup > NetworkSetter; + typedef typename CppUnit::TestCaller< TesterType > TestCallerType; + + tnlSparseNetworkTester(){}; virtual - ~tnlSparseGraphTester(){}; + ~tnlSparseNetworkTester(){}; static CppUnit :: Test* suite() { - tnlString testSuiteName( "tnlSparseGraphTester< " ); - testSuiteName += GraphType::getType() + " >"; + tnlString testSuiteName( "tnlSparseNetworkTester< " ); + testSuiteName += NetworkType::getType() + " >"; CppUnit :: TestSuite* suiteOfTests = new CppUnit :: TestSuite( testSuiteName.getString() ); CppUnit :: TestResult result; @@ -116,32 +116,32 @@ class tnlSparseGraphTester : public CppUnit :: TestCase suiteOfTests->addTest( new TestCallerType( "setLikeTest", &TesterType::setLikeTest ) ); suiteOfTests->addTest( new TestCallerType( "setElementTest", &TesterType::setElementTest ) ); suiteOfTests->addTest( new TestCallerType( "setElementFastTest", &TesterType::setElementFastTest ) ); - suiteOfTests->addTest( new TestCallerType( "setElement_DiagonalGraphTest", &TesterType::setElement_DiagonalGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setElementFast_DiagonalGraphTest", &TesterType::setElementFast_DiagonalGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setElement_DenseGraphTest", &TesterType::setElement_DenseGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setElementFast_DenseGraphTest", &TesterType::setElementFast_DenseGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setElement_LowerTriangularGraphTest", &TesterType::setElement_LowerTriangularGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setElementFast_LowerTriangularGraphTest", &TesterType::setElementFast_LowerTriangularGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setRow_DiagonalGraphTest", &TesterType::setRow_DiagonalGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setRowFast_DiagonalGraphTest", &TesterType::setRowFast_DiagonalGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setRow_DenseGraphTest", &TesterType::setRow_DenseGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setRowFast_DenseGraphTest", &TesterType::setRowFast_DenseGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setRow_LowerTriangularGraphTest", &TesterType::setRow_LowerTriangularGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "setRowFast_LowerTriangularGraphTest", &TesterType::setRowFast_LowerTriangularGraphTest ) ); + suiteOfTests->addTest( new TestCallerType( "setElement_DiagonalNetworkTest", &TesterType::setElement_DiagonalNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setElementFast_DiagonalNetworkTest", &TesterType::setElementFast_DiagonalNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setElement_DenseNetworkTest", &TesterType::setElement_DenseNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setElementFast_DenseNetworkTest", &TesterType::setElementFast_DenseNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setElement_LowerTriangularNetworkTest", &TesterType::setElement_LowerTriangularNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setElementFast_LowerTriangularNetworkTest", &TesterType::setElementFast_LowerTriangularNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setRow_DiagonalNetworkTest", &TesterType::setRow_DiagonalNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setRowFast_DiagonalNetworkTest", &TesterType::setRowFast_DiagonalNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setRow_DenseNetworkTest", &TesterType::setRow_DenseNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setRowFast_DenseNetworkTest", &TesterType::setRowFast_DenseNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setRow_LowerTriangularNetworkTest", &TesterType::setRow_LowerTriangularNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "setRowFast_LowerTriangularNetworkTest", &TesterType::setRowFast_LowerTriangularNetworkTest ) ); suiteOfTests->addTest( new TestCallerType( "addElementTest", &TesterType::addElementTest ) ); - suiteOfTests->addTest( new TestCallerType( "vectorProduct_DiagonalGraphTest", &TesterType::vectorProduct_DiagonalGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "vectorProduct_DenseGraphTest", &TesterType::vectorProduct_DenseGraphTest ) ); - suiteOfTests->addTest( new TestCallerType( "vectorProduct_LowerTriangularGraphTest", &TesterType::vectorProduct_LowerTriangularGraphTest ) ); + suiteOfTests->addTest( new TestCallerType( "vectorProduct_DiagonalNetworkTest", &TesterType::vectorProduct_DiagonalNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "vectorProduct_DenseNetworkTest", &TesterType::vectorProduct_DenseNetworkTest ) ); + suiteOfTests->addTest( new TestCallerType( "vectorProduct_LowerTriangularNetworkTest", &TesterType::vectorProduct_LowerTriangularNetworkTest ) ); /*suiteOfTests -> addTest( new TestCallerType( "graphTranspositionTest", &TesterType::graphTranspositionTest ) ); - suiteOfTests -> addTest( new TestCallerType( "addGraphTest", &TesterType::addGraphTest ) );*/ + suiteOfTests -> addTest( new TestCallerType( "addNetworkTest", &TesterType::addNetworkTest ) );*/ return suiteOfTests; } void setDimensionsTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); CPPUNIT_ASSERT( m.getRows() == 10 ); CPPUNIT_ASSERT( m.getColumns() == 10 ); @@ -149,9 +149,9 @@ class tnlSparseGraphTester : public CppUnit :: TestCase void setLikeTest() { - GraphType m1, m2; - GraphSetter::setup( m1 ); - GraphSetter::setup( m2 ); + NetworkType m1, m2; + NetworkSetter::setup( m1 ); + NetworkSetter::setup( m2 ); m1.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m1.getRows() ); @@ -166,8 +166,8 @@ class tnlSparseGraphTester : public CppUnit :: TestCase */ void setElementTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -186,8 +186,8 @@ class tnlSparseGraphTester : public CppUnit :: TestCase void setElementFastTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -204,12 +204,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::getDevice() == tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); - tnlSparseGraphTester__setElementFastTestCudaKernel< GraphType > + tnlSparseNetworkTester__setElementFastTestCudaKernel< NetworkType > <<< cudaGridSize, cudaBlockSize >>> ( kernel_graph, kernel_testResult ); @@ -224,10 +224,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( m.getElement( 0, i ) == i ); } - void setElement_DiagonalGraphTest() + void setElement_DiagonalNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -249,10 +249,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - void setElementFast_DiagonalGraphTest() + void setElementFast_DiagonalNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -267,12 +267,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); - tnlSparseGraphTester__setElementFast_DiagonalGraphTestCudaKernel< GraphType > + tnlSparseNetworkTester__setElementFast_DiagonalNetworkTestCudaKernel< NetworkType > <<< cudaGridSize, cudaBlockSize >>> ( kernel_graph, kernel_testResult ); @@ -295,10 +295,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - void setElement_DenseGraphTest() + void setElement_DenseNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -330,10 +330,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( m.getElement( i, j ) == i+j ); } - void setElementFast_DenseGraphTest() + void setElementFast_DenseNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -351,12 +351,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); - tnlSparseGraphTester__setElementFast_DenseGraphTestCudaKernel1< GraphType > + tnlSparseNetworkTester__setElementFast_DenseNetworkTestCudaKernel1< NetworkType > <<< cudaGridSize, cudaBlockSize >>> ( kernel_graph, kernel_testResult ); @@ -386,12 +386,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); - tnlSparseGraphTester__setElementFast_DenseGraphTestCudaKernel2< GraphType > + tnlSparseNetworkTester__setElementFast_DenseNetworkTestCudaKernel2< NetworkType > <<< cudaGridSize, cudaBlockSize >>> ( kernel_graph, kernel_testResult ); @@ -408,10 +408,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } - void setElement_LowerTriangularGraphTest() + void setElement_LowerTriangularNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -445,10 +445,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( m.getElement( i, j ) == 0 ); } - void setElementFast_LowerTriangularGraphTest() + void setElementFast_LowerTriangularNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -465,12 +465,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); - tnlSparseGraphTester__setElementFast_LowerTriangularGraphTestCudaKernel1< GraphType > + tnlSparseNetworkTester__setElementFast_LowerTriangularNetworkTestCudaKernel1< NetworkType > <<< cudaGridSize, cudaBlockSize >>> ( kernel_graph, kernel_testResult ); @@ -500,12 +500,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); - tnlSparseGraphTester__setElementFast_LowerTriangularGraphTestCudaKernel2< GraphType > + tnlSparseNetworkTester__setElementFast_LowerTriangularNetworkTestCudaKernel2< NetworkType > <<< cudaGridSize, cudaBlockSize >>> ( kernel_graph, kernel_testResult ); @@ -527,8 +527,8 @@ class tnlSparseGraphTester : public CppUnit :: TestCase void addElementTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -555,10 +555,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase /**** * Set row tests */ - void setRow_DiagonalGraphTest() + void setRow_DiagonalNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -586,10 +586,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - void setRowFast_DiagonalGraphTest() + void setRowFast_DiagonalNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -611,13 +611,13 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); int sharedMemory = 100 * ( sizeof( IndexType ) + sizeof( RealType ) ); - tnlSparseGraphTester__setRowFast_DiagonalGraphTestCudaKernel< GraphType > + tnlSparseNetworkTester__setRowFast_DiagonalNetworkTestCudaKernel< NetworkType > <<< cudaGridSize, cudaBlockSize, sharedMemory >>> ( kernel_graph, kernel_testResult ); @@ -640,10 +640,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - void setRow_DenseGraphTest() + void setRow_DenseNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -687,10 +687,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( m.getElement( i, j ) == i+j ); } - void setRowFast_DenseGraphTest() + void setRowFast_DenseNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -718,13 +718,13 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); int sharedMemory = 100 * ( sizeof( IndexType ) + sizeof( RealType ) ); - tnlSparseGraphTester__setRowFast_DenseGraphTestCudaKernel1< GraphType > + tnlSparseNetworkTester__setRowFast_DenseNetworkTestCudaKernel1< NetworkType > <<< cudaGridSize, cudaBlockSize, sharedMemory >>> ( kernel_graph, kernel_testResult ); @@ -758,13 +758,13 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); int sharedMemory = 100 * ( sizeof( IndexType ) + sizeof( RealType ) ); - tnlSparseGraphTester__setRowFast_DenseGraphTestCudaKernel2< GraphType > + tnlSparseNetworkTester__setRowFast_DenseNetworkTestCudaKernel2< NetworkType > <<< cudaGridSize, cudaBlockSize, sharedMemory >>> ( kernel_graph, kernel_testResult ); @@ -780,10 +780,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( m.getElement( i, j ) == i+j ); } - void setRow_LowerTriangularGraphTest() + void setRow_LowerTriangularNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -830,10 +830,10 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( m.getElement( i, j ) == 0 ); } - void setRowFast_LowerTriangularGraphTest() + void setRowFast_LowerTriangularNetworkTest() { - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( 10, 10 ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -859,13 +859,13 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); int sharedMemory = 100 * ( sizeof( IndexType ) + sizeof( RealType ) ); - tnlSparseGraphTester__setRowFast_LowerTriangularGraphTestCudaKernel< GraphType > + tnlSparseNetworkTester__setRowFast_LowerTriangularNetworkTestCudaKernel< NetworkType > <<< cudaGridSize, cudaBlockSize, sharedMemory >>> ( kernel_graph, kernel_testResult ); @@ -899,13 +899,13 @@ class tnlSparseGraphTester : public CppUnit :: TestCase if( DeviceType::DeviceType == ( int ) tnlCudaDevice ) { #ifdef HAVE_CUDA - GraphType* kernel_graph = tnlCuda::passToDevice( m ); + NetworkType* kernel_graph = tnlCuda::passToDevice( m ); bool testResult( true ); bool* kernel_testResult = tnlCuda::passToDevice( testResult ); checkCudaDevice; dim3 cudaBlockSize( 256 ), cudaGridSize( 1 ); int sharedMemory = 100 * ( sizeof( IndexType ) + sizeof( RealType ) ); - tnlSparseGraphTester__setRowFast_LowerTriangularGraphTestCudaKernel< GraphType > + tnlSparseNetworkTester__setRowFast_LowerTriangularNetworkTestCudaKernel< NetworkType > <<< cudaGridSize, cudaBlockSize, sharedMemory >>> ( kernel_graph, kernel_testResult ); @@ -925,14 +925,14 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } - void vectorProduct_DiagonalGraphTest() + void vectorProduct_DiagonalNetworkTest() { const int size = 10; VectorType v, w; v.setSize( size ); w.setSize( size ); - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( size, size ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -949,14 +949,14 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( w.getElement( i ) == i*i ); } - void vectorProduct_DenseGraphTest() + void vectorProduct_DenseNetworkTest() { const int size = 10; VectorType v, w; v.setSize( size ); w.setSize( size ); - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( size, size ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -974,14 +974,14 @@ class tnlSparseGraphTester : public CppUnit :: TestCase CPPUNIT_ASSERT( w.getElement( i ) == i*size ); } - void vectorProduct_LowerTriangularGraphTest() + void vectorProduct_LowerTriangularNetworkTest() { const int size = 10; VectorType v, w; v.setSize( size ); w.setSize( size ); - GraphType m; - GraphSetter::setup( m ); + NetworkType m; + NetworkSetter::setup( m ); m.setDimensions( size, size ); IndexVector rowLengths; rowLengths.setSize( m.getRows() ); @@ -1000,7 +1000,7 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } - void addGraphTest() + void addNetworkTest() { } @@ -1010,8 +1010,8 @@ class tnlSparseGraphTester : public CppUnit :: TestCase }; #ifdef HAVE_CUDA - template< typename GraphType > - __global__ void tnlSparseGraphTester__setElementFastTestCudaKernel( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setElementFastTestCudaKernel( NetworkType* graph, bool* testResult ) { if( threadIdx.x == 0 ) @@ -1024,19 +1024,19 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setElementFast_DiagonalGraphTestCudaKernel( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setElementFast_DiagonalNetworkTestCudaKernel( NetworkType* graph, bool* testResult ) { if( threadIdx.x < graph->getRows() ) graph->setElementFast( threadIdx.x, threadIdx.x, threadIdx.x ); } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setElementFast_DenseGraphTestCudaKernel1( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setElementFast_DenseNetworkTestCudaKernel1( NetworkType* graph, bool* testResult ) { - const typename GraphType::IndexType i = threadIdx.x; + const typename NetworkType::IndexType i = threadIdx.x; if( i < graph->getRows() ) { graph->setElementFast( i, i, i ); @@ -1045,11 +1045,11 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setElementFast_DenseGraphTestCudaKernel2( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setElementFast_DenseNetworkTestCudaKernel2( NetworkType* graph, bool* testResult ) { - const typename GraphType::IndexType i = threadIdx.x; + const typename NetworkType::IndexType i = threadIdx.x; if( i < graph->getRows() ) { for( int j = graph->getColumns() -1; j >= 0; j-- ) @@ -1057,11 +1057,11 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setElementFast_LowerTriangularGraphTestCudaKernel1( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setElementFast_LowerTriangularNetworkTestCudaKernel1( NetworkType* graph, bool* testResult ) { - const typename GraphType::IndexType i = threadIdx.x; + const typename NetworkType::IndexType i = threadIdx.x; if( i < graph->getRows() ) { for( int j = 0; j <= i; j++ ) @@ -1069,11 +1069,11 @@ class tnlSparseGraphTester : public CppUnit :: TestCase } } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setElementFast_LowerTriangularGraphTestCudaKernel2( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setElementFast_LowerTriangularNetworkTestCudaKernel2( NetworkType* graph, bool* testResult ) { - const typename GraphType::IndexType i = threadIdx.x; + const typename NetworkType::IndexType i = threadIdx.x; if( i < graph->getRows() ) { for( int j = i; j >= 0; j-- ) @@ -1084,12 +1084,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase /**** * Set row tests kernels */ - template< typename GraphType > - __global__ void tnlSparseGraphTester__setRowFast_DiagonalGraphTestCudaKernel( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setRowFast_DiagonalNetworkTestCudaKernel( NetworkType* graph, bool* testResult ) { - typedef typename GraphType::RealType RealType; - typedef typename GraphType::IndexType IndexType; + typedef typename NetworkType::RealType RealType; + typedef typename NetworkType::IndexType IndexType; const IndexType row = threadIdx.x; if( row >= graph->getRows() ) @@ -1105,12 +1105,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase graph->setRowFast( row, &columnIndexes[ row ], values, 1 ); } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setRowFast_DenseGraphTestCudaKernel1( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setRowFast_DenseNetworkTestCudaKernel1( NetworkType* graph, bool* testResult ) { - typedef typename GraphType::RealType RealType; - typedef typename GraphType::IndexType IndexType; + typedef typename NetworkType::RealType RealType; + typedef typename NetworkType::IndexType IndexType; const IndexType row = threadIdx.x; if( row >= graph->getRows() ) @@ -1132,12 +1132,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase graph->setRowFast( row, columnIndexes, values, 10 ); } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setRowFast_DenseGraphTestCudaKernel2( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setRowFast_DenseNetworkTestCudaKernel2( NetworkType* graph, bool* testResult ) { - typedef typename GraphType::RealType RealType; - typedef typename GraphType::IndexType IndexType; + typedef typename NetworkType::RealType RealType; + typedef typename NetworkType::IndexType IndexType; const IndexType row = threadIdx.x; if( row >= graph->getRows() ) @@ -1156,12 +1156,12 @@ class tnlSparseGraphTester : public CppUnit :: TestCase graph->setRowFast( row, columnIndexes, values, 10 ); } - template< typename GraphType > - __global__ void tnlSparseGraphTester__setRowFast_LowerTriangularGraphTestCudaKernel( GraphType* graph, + template< typename NetworkType > + __global__ void tnlSparseNetworkTester__setRowFast_LowerTriangularNetworkTestCudaKernel( NetworkType* graph, bool* testResult ) { - typedef typename GraphType::RealType RealType; - typedef typename GraphType::IndexType IndexType; + typedef typename NetworkType::RealType RealType; + typedef typename NetworkType::IndexType IndexType; const IndexType row = threadIdx.x; if( row >= graph->getRows() ) -- GitLab