Loading src/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ ADD_SUBDIRECTORY( functors ) ADD_SUBDIRECTORY( config ) ADD_SUBDIRECTORY( core ) ADD_SUBDIRECTORY( debug ) ADD_SUBDIRECTORY( graphs ) ADD_SUBDIRECTORY( matrices ) ADD_SUBDIRECTORY( mesh ) ADD_SUBDIRECTORY( operators ) Loading src/graphs/CMakeLists.txt 0 → 100644 +20 −0 Original line number Diff line number Diff line SET( headers tnlEllpackGraph.h tnlEllpackGraph_impl.h tnlEllpackGraphLinksAccessor.h tnlEllpackGraphLinksAccessor_impl.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/graphs ) set( common_SOURCES ) IF( BUILD_CUDA ) set( tnl_graphs_CUDA__SOURCES ${common_SOURCES} PARENT_SCOPE ) ENDIF() set( tnl_graphs_SOURCES ${common_SOURCES} PARENT_SCOPE ) INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/graphs ) No newline at end of file src/graphs/tnlEllpackGraph.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /*************************************************************************** tnlEllpackGraph.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_H #define TNLELLPACKGRAPH_H #include <graphs/sparse/tnlEllpackGraphLinksAccessor.h> template< typename Device = tnlHost, typename Index = int > class tnlEllpackGraphConstLinksAccessor; template< typename Device = tnlHost, typename Index = int > class tnlEllpackGraph { public: typedef Device DeviceType; typedef Index IndexType; typedef tnlEllpackGraphLinksAccessor< DeviceType, IndexType > LinksAccessorType; typedef tnlEllpackGraphConstLinksAccessor< DeviceType, IndexType > ConstLinksAccessorType; typedef tnlVector< IndexType, DeviceType, IndexType > LinksPerNodesVectorType; tnlEllpackGraph(); void setNumberOfNodes( const IndexType nodes ); void setNumberOfLinksPerNode( const LinksPerNodesVectorType& linksPerNode ); LinksAccessorType getNodeLinksAccessor( const IndexType& nodeIndex ); ConstLinksAccessorType getNodeLinksAccessor( const IndexType& nodeIndex ) const; protected: tnlVector< IndexType, DeviceType, IndexType > links; IndexType maxLinksPerNode, numberOfNodes; }; #endif /* TNLELLPACKGRAPH_H */ src/graphs/tnlEllpackGraphLinksAccessor.h 0 → 100644 +57 −0 Original line number Diff line number Diff line /*************************************************************************** tnlEllpackGraph.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 TNLELLPACKGRAPHLINKSACCESSOR_H #define TNLELLPACKGRAPHLINKSACCESSOR_H template< typename Device, typename Index > class tnlEllpackGraphLinksAccessor { public: typedef Device DeviceType; typedef Index IndexType; typedef tnlEllpackGraph< DeviceType, IndexType > GraphType; void setLink( const IndexType linkIndex, const IndexType targetNode ); IndexType getLinkTarget( const IndexType linkIndex ) const; IndexType& operator[]( const IndexType linkIndex ); const IndexType& operator[]( const IndexType linkIndex ) const; protected: tnlEllpackGraphLinksAccessor( IndexType* graphLinks, const IndexType node, const maxLinksPerNode ); IndexType* links; IndexType step, maxLinksPerNode; friend tnlEllpackGraph< IndexType, DeviceType >; }; #include <graphs/sparse/tnlEllpackGraphLinksAccessor_impl.h> #endif /* TNLELLPACKGRAPHLINKSACCESSOR_H */ src/graphs/tnlEllpackGraphLinksAccessor_impl.h 0 → 100644 +72 −0 Original line number Diff line number Diff line /*************************************************************************** tnlEllpackGraph_impl.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 TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H #define TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H template< typename Device, typename Index > tnlEllpackGraphLinksAccessor< Device, Index >:: tnlEllpackGraphLinksAccessor( IndexType* graphLinks, const IndexType node, const IndexType maxLinksPerNode ) { this->links = &graphLinks[ node * maxLinksPerNode ]; this->maxLinksPerNode = maxLinksPerNode; } template< typename Device, typename Index > void tnlEllpackGraphLinksAccessor< Device, Index >:: setLink( const IndexType linkIndex, const IndexType targetNode ) { links[ linkIndex ] = targetNode; } template< typename Device, typename Index > Index tnlEllpackGraphLinksAccessor< Device, Index >:: getLinkTarget( const IndexType linkIndex ) const { return links[ linkIndex ]; } template< typename Device, typename Index > Index& tnlEllpackGraphLinksAccessor< Device, Index >:: operator[]( const IndexType linkIndex ) { return links[ linkIndex ]; } template< typename Device, typename Index > const Index& tnlEllpackGraphLinksAccessor< Device, Index >:: operator[]( const IndexType linkIndex ) const { return links[ linkIndex ]; } #endif /* TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H */ Loading
src/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ ADD_SUBDIRECTORY( functors ) ADD_SUBDIRECTORY( config ) ADD_SUBDIRECTORY( core ) ADD_SUBDIRECTORY( debug ) ADD_SUBDIRECTORY( graphs ) ADD_SUBDIRECTORY( matrices ) ADD_SUBDIRECTORY( mesh ) ADD_SUBDIRECTORY( operators ) Loading
src/graphs/CMakeLists.txt 0 → 100644 +20 −0 Original line number Diff line number Diff line SET( headers tnlEllpackGraph.h tnlEllpackGraph_impl.h tnlEllpackGraphLinksAccessor.h tnlEllpackGraphLinksAccessor_impl.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/graphs ) set( common_SOURCES ) IF( BUILD_CUDA ) set( tnl_graphs_CUDA__SOURCES ${common_SOURCES} PARENT_SCOPE ) ENDIF() set( tnl_graphs_SOURCES ${common_SOURCES} PARENT_SCOPE ) INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/graphs ) No newline at end of file
src/graphs/tnlEllpackGraph.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /*************************************************************************** tnlEllpackGraph.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_H #define TNLELLPACKGRAPH_H #include <graphs/sparse/tnlEllpackGraphLinksAccessor.h> template< typename Device = tnlHost, typename Index = int > class tnlEllpackGraphConstLinksAccessor; template< typename Device = tnlHost, typename Index = int > class tnlEllpackGraph { public: typedef Device DeviceType; typedef Index IndexType; typedef tnlEllpackGraphLinksAccessor< DeviceType, IndexType > LinksAccessorType; typedef tnlEllpackGraphConstLinksAccessor< DeviceType, IndexType > ConstLinksAccessorType; typedef tnlVector< IndexType, DeviceType, IndexType > LinksPerNodesVectorType; tnlEllpackGraph(); void setNumberOfNodes( const IndexType nodes ); void setNumberOfLinksPerNode( const LinksPerNodesVectorType& linksPerNode ); LinksAccessorType getNodeLinksAccessor( const IndexType& nodeIndex ); ConstLinksAccessorType getNodeLinksAccessor( const IndexType& nodeIndex ) const; protected: tnlVector< IndexType, DeviceType, IndexType > links; IndexType maxLinksPerNode, numberOfNodes; }; #endif /* TNLELLPACKGRAPH_H */
src/graphs/tnlEllpackGraphLinksAccessor.h 0 → 100644 +57 −0 Original line number Diff line number Diff line /*************************************************************************** tnlEllpackGraph.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 TNLELLPACKGRAPHLINKSACCESSOR_H #define TNLELLPACKGRAPHLINKSACCESSOR_H template< typename Device, typename Index > class tnlEllpackGraphLinksAccessor { public: typedef Device DeviceType; typedef Index IndexType; typedef tnlEllpackGraph< DeviceType, IndexType > GraphType; void setLink( const IndexType linkIndex, const IndexType targetNode ); IndexType getLinkTarget( const IndexType linkIndex ) const; IndexType& operator[]( const IndexType linkIndex ); const IndexType& operator[]( const IndexType linkIndex ) const; protected: tnlEllpackGraphLinksAccessor( IndexType* graphLinks, const IndexType node, const maxLinksPerNode ); IndexType* links; IndexType step, maxLinksPerNode; friend tnlEllpackGraph< IndexType, DeviceType >; }; #include <graphs/sparse/tnlEllpackGraphLinksAccessor_impl.h> #endif /* TNLELLPACKGRAPHLINKSACCESSOR_H */
src/graphs/tnlEllpackGraphLinksAccessor_impl.h 0 → 100644 +72 −0 Original line number Diff line number Diff line /*************************************************************************** tnlEllpackGraph_impl.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 TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H #define TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H template< typename Device, typename Index > tnlEllpackGraphLinksAccessor< Device, Index >:: tnlEllpackGraphLinksAccessor( IndexType* graphLinks, const IndexType node, const IndexType maxLinksPerNode ) { this->links = &graphLinks[ node * maxLinksPerNode ]; this->maxLinksPerNode = maxLinksPerNode; } template< typename Device, typename Index > void tnlEllpackGraphLinksAccessor< Device, Index >:: setLink( const IndexType linkIndex, const IndexType targetNode ) { links[ linkIndex ] = targetNode; } template< typename Device, typename Index > Index tnlEllpackGraphLinksAccessor< Device, Index >:: getLinkTarget( const IndexType linkIndex ) const { return links[ linkIndex ]; } template< typename Device, typename Index > Index& tnlEllpackGraphLinksAccessor< Device, Index >:: operator[]( const IndexType linkIndex ) { return links[ linkIndex ]; } template< typename Device, typename Index > const Index& tnlEllpackGraphLinksAccessor< Device, Index >:: operator[]( const IndexType linkIndex ) const { return links[ linkIndex ]; } #endif /* TNLELLPACKGRAPHLINKSACCESSOR_IMPL_H */