diff --git a/AUTHORS b/AUTHORS index c3a12fe499b7478498ddf2be897558e71884f731..aa3d2fd53258967e3ad424e1482dc7b9e325a75b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,10 @@ Oberhuber Tomas <tomas.oberhuber@fjfi.cvut.cz> -Zabka Vitezslav <zabkavit@fjfi.cvut.cz> -Vladimir Klement -Tomáš SobotĂk -OndĹ™ej SzĂ©kely -Jiřà Kafka +Zabka Vitezslav <zabkav@gmail.com> +Vladimir Klement <wlada@post.cz> +Tomáš SobotĂk <sobotik.tomas@gmail.com> +OndĹ™ej SzĂ©kely <ondra.szekely@gmail.com> Libor Bakajsa -Jakub KlinkovskĂ˝ +Jakub KlinkovskĂ˝ <klinkjak@fjfi.cvut.cz> Vacata Jan Heller Martin Novotny Matej diff --git a/INSTALL b/INSTALL index ab759d74a7ea9dc57225f4f0fac1479dc58e7ac7..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/INSTALL +++ b/INSTALL @@ -1 +0,0 @@ -/usr/local/share/automake-1.11/INSTALL \ No newline at end of file diff --git a/README b/README index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c3fbdba004a30a88987771678b222997ea44cc0f 100644 --- a/README +++ b/README @@ -0,0 +1,80 @@ +Installation +============ + + Requirements: + + To install TNL, you need: + + cmake 3.4 or later (https://cmake.org/download/) + GNU g++ 4.8 or later (https://gcc.gnu.org/) + CUDA 8.0 or later (https://developer.nvidia.com/cuda-downloads) + + For image processing problems, you may optionaly install: + DCMTK (http://dicom.offis.de/dcmtk.php.en) + libpng (http://www.libpng.org/pub/png/libpng.html) + libjpeg (http://libjpeg.sourceforge.net/) + + The latest release of TNL can be downloaded as: + + wget tnl-project.org/data/src/tnl-0.1.tar.bz2 + + Unpack it as: + + tar xvf tnl-0.1.tar.bz2 + cd tnl-0.1 + + Executing command + + ./install + + will install TNL to a folder ${HOME}/.local . You may change it by + + ./install --prefix=<TNL prefix> + + During the installation, TNL fetches latest version of Gtest and install it only + locally to sub-folders Debug and Release. At the end of the installation, the + script is checking if the prefix folder is visible to your bash and your linker. + If not, it informs you how to change your ${HOME}/.bashrc file to fix it. + +How to write a simple solver +============================ + +To implement your own solver: + + Create and go to your working directory + + mkdir MyProblem + cd Myproblem + + Execute a command tnl-quickstart + + tnl-quickstart + + Answer the questions as, for example, follows + + TNL Quickstart -- solver generator + ---------------------------------- + Problem name:My Problem + Problem class base name (base name acceptable in C++ code):MyProblem + Operator name:Laplace + + Write your numerical scheme by editing a file + + Laplace_impl.h + + on lines: + 34, 141 and 265 for 1D, 2D and 3D problem respectively with explicit time discretization + 101, 211 and 332 for 1D, 2D and 3D problem respectively with (semi-)implicit time discretization + Compile the program by executing + + make + + for CPU version only or + + make WITH_CUDA=yes + + for a solver running on both CPU and GPU. Run it on your favourite HW architecture by executing + + ./MyProblem + + and following the printed help. diff --git a/doc/pde-solvers.rst b/doc/pde-solvers.rst index 6f7eed46d377e19862f297d31ec6d70f3846ed56..d93e49e5a6901c091f1e6672bc91bb2451b75943 100644 --- a/doc/pde-solvers.rst +++ b/doc/pde-solvers.rst @@ -1,3 +1,9 @@ =========== PDE Solvers =========== + +Finite difference method + + Elliptic problems + + Parabolic problems \ No newline at end of file diff --git a/examples/advection/LaxFridrichs.h b/examples/advection/LaxFridrichs.h index 46e63b77a2fa7661b8f7dd83cae964eab0c61272..f3453f69b06293c6a61837ba0045aacba243f66f 100644 --- a/examples/advection/LaxFridrichs.h +++ b/examples/advection/LaxFridrichs.h @@ -27,7 +27,7 @@ class LaxFridrichs< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index > typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; Real tau; Real artificalViscosity; Real advectionSpeedX; @@ -94,7 +94,7 @@ class LaxFridrichs< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index > typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; Real tau; Real artificalViscosity; Real advectionSpeedX; @@ -161,7 +161,7 @@ class LaxFridrichs< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index > typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; Real tau; Real artificalViscosity; Real advectionSpeedX; diff --git a/examples/advection/LaxFridrichs_impl.h b/examples/advection/LaxFridrichs_impl.h index dc65664b3b5b8ef599d61988924b3a705b6f94ca..131e7dff6a3321baa8ad1c53252e1be7a37b4bb5 100644 --- a/examples/advection/LaxFridrichs_impl.h +++ b/examples/advection/LaxFridrichs_impl.h @@ -39,14 +39,14 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); double a; a = this->advectionSpeedX; return (0.5 / this->tau ) * this->artificalViscosity * @@ -75,7 +75,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -102,11 +102,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -148,17 +148,17 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); double a; double b; a = this->advectionSpeedX; @@ -191,7 +191,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -218,14 +218,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -269,20 +269,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -308,7 +308,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - //return 2*Dimensions + 1; + //return 2*Dimension + 1; } template< typename MeshReal, @@ -335,17 +335,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - /* const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + /* const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/advection/advection.h b/examples/advection/advection.h index dc8d52ae085b277225634637969e72e2d3ff6a40..44daebed11366c594e7abe581e0a1fa8f96bad3d 100644 --- a/examples/advection/advection.h +++ b/examples/advection/advection.h @@ -70,10 +70,10 @@ class advectionSetter static bool run( const Config::ParameterContainer & parameters ) { - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; typedef LaxFridrichs< MeshType, Real, Index > ApproximateOperator; typedef advectionRhs< MeshType, Real > RightHandSide; - typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex; + typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point; /**** * Resolve the template arguments of your solver here. @@ -83,10 +83,10 @@ class advectionSetter String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) { - typedef Functions::Analytic::Constant< Dimensions, Real > Constant; + typedef Functions::Analytic::Constant< Dimension, Real > Constant; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef advectionProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); @@ -99,7 +99,7 @@ class advectionSetter typedef Functions::MeshFunction< MeshType > MeshFunction; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef advectionProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); diff --git a/examples/advection/advectionBuildConfigTag.h b/examples/advection/advectionBuildConfigTag.h index 98371b43a3fce8743b7945bbec10ef04ce0d219c..c90930ecd8db938baf75165ac6c1db126536bd0b 100644 --- a/examples/advection/advectionBuildConfigTag.h +++ b/examples/advection/advectionBuildConfigTag.h @@ -25,9 +25,9 @@ template<> struct ConfigTagIndex< advectionBuildConfigTag, long int >{ enum { en * Use of Grid is enabled for allowed dimensions and Real, Device and Index types. */ -template< int Dimensions, typename Real, typename Device, typename Index > - struct ConfigTagMesh< advectionBuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > > - { enum { enabled = ConfigTagDimensions< advectionBuildConfigTag, Dimensions >::enabled && +template< int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< advectionBuildConfigTag, Meshes::Grid< Dimension, Real, Device, Index > > + { enum { enabled = ConfigTagDimension< advectionBuildConfigTag, Dimension >::enabled && ConfigTagReal< advectionBuildConfigTag, Real >::enabled && ConfigTagDevice< advectionBuildConfigTag, Device >::enabled && ConfigTagIndex< advectionBuildConfigTag, Index >::enabled }; }; diff --git a/examples/advection/advectionProblem_impl.h b/examples/advection/advectionProblem_impl.h index bebfff5c631a979af3d0a7e35a7686cdfabf0348..d391b1988a3f75a3b0ab858b77d73a4b0e6f702e 100644 --- a/examples/advection/advectionProblem_impl.h +++ b/examples/advection/advectionProblem_impl.h @@ -198,17 +198,17 @@ setupLinearSystem( const MeshPointer& mesh, Matrix& matrix ) { const IndexType dofs = this->getDofs( mesh ); - typedef typename Matrix::ObjectType::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; - SharedPointer< CompressedRowsLengthsVectorType > rowLengths; + typedef typename Matrix::ObjectType::CompressedRowLengthsVector CompressedRowLengthsVectorType; + SharedPointer< CompressedRowLengthsVectorType > rowLengths; if( ! rowLengths->setSize( dofs ) ) return false; - Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; - matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh, + Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter; + matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( mesh, differentialOperatorPointer, boundaryConditionPointer, rowLengths ); matrix->setDimensions( dofs, dofs ); - if( ! matrix->setCompressedRowsLengths( *rowLengths ) ) + if( ! matrix->setCompressedRowLengths( *rowLengths ) ) return false; return true; } @@ -280,26 +280,18 @@ getExplicitUpdate( const RealType& time, *(_u[i*count+j-1]-_u[(i-2)*count+j-1])) ;} } - else if (this->velocityType == "advection") -*/ { - this->bindDofs( mesh, _u ); - Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; - SharedPointer< MeshFunctionType > u( mesh, _u ); - SharedPointer< MeshFunctionType > fu( mesh, _fu ); - differentialOperatorPointer->setTau(tau); - explicitUpdater.template update< typename Mesh::Cell >( time, - mesh, - this->differentialOperatorPointer, - this->boundaryConditionPointer, - this->rightHandSidePointer, - u, - fu ); -/* BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; - boundaryConditionsSetter.template apply< typename Mesh::Cell >( - this->boundaryCondition, - time + tau, - u ); */ - } + else if (this->velocityType == "advection")*/ + { + this->bindDofs( mesh, _u ); + Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; + SharedPointer< MeshFunctionType > u( mesh, _u ); + SharedPointer< MeshFunctionType > fu( mesh, _fu ); + differentialOperatorPointer->setTau(tau); + explicitUpdater.setDifferentialOperator( this->differentialOperatorPointer ); + explicitUpdater.setBoundaryConditions( this->boundaryConditionPointer ); + explicitUpdater.setRightHandSide( this->rightHandSidePointer ); + explicitUpdater.template update< typename Mesh::Cell >( time, tau, mesh, u, fu ); + } } template< typename Mesh, typename BoundaryCondition, diff --git a/examples/advection/advectionRhs.h b/examples/advection/advectionRhs.h index 1ddb255a09906deece99fbf31df54659f3740a92..f32ef008cc9a007b6923400f81c282970720ef3d 100644 --- a/examples/advection/advectionRhs.h +++ b/examples/advection/advectionRhs.h @@ -5,7 +5,7 @@ namespace TNL { template< typename Mesh, typename Real >class advectionRhs - : public Functions::Domain< Mesh::meshDimensions, Functions::MeshDomain > + : public Functions::Domain< Mesh::meshDimension, Functions::MeshDomain > { public: @@ -23,8 +23,8 @@ template< typename Mesh, typename Real >class advectionRhs Real operator()( const MeshEntity& entity, const Real& time = 0.0 ) const { - typedef typename MeshEntity::MeshType::VertexType VertexType; - VertexType v = entity.getCenter(); + typedef typename MeshEntity::MeshType::PointType PointType; + PointType v = entity.getCenter(); return 0.0; } }; diff --git a/examples/heat-equation/HeatEquationBuildConfigTag.h b/examples/heat-equation/HeatEquationBuildConfigTag.h new file mode 100644 index 0000000000000000000000000000000000000000..8579b7f473c6ab1a3472aaa8a11913758390a15a --- /dev/null +++ b/examples/heat-equation/HeatEquationBuildConfigTag.h @@ -0,0 +1,60 @@ +/*************************************************************************** + HeatEquationBuildConfigTag.h - description + ------------------- + begin : Jul 7, 2014 + copyright : (C) 2014 by Tomas Oberhuber + email : tomas.oberhuber@fjfi.cvut.cz + ***************************************************************************/ + +/* See Copyright Notice in tnl/Copyright */ + +#pragma once + +#include <TNL/Solvers/BuildConfigTags.h> + +namespace TNL { +namespace Solvers { + +class HeatEquationBuildConfig +{ + public: + + static void print() { std::cerr << "HeatEquationBuildConfig" << std::endl; } +}; + +/**** + * Turn off support for float and long double. + */ +template<> struct ConfigTagReal< HeatEquationBuildConfig, float > { enum { enabled = false }; }; +template<> struct ConfigTagReal< HeatEquationBuildConfig, long double > { enum { enabled = false }; }; + +/**** + * Turn off support for short int and long int indexing. + */ +template<> struct ConfigTagIndex< HeatEquationBuildConfig, short int >{ enum { enabled = false }; }; +template<> struct ConfigTagIndex< HeatEquationBuildConfig, long int >{ enum { enabled = false }; }; + +/**** + * Use of Grid is enabled for allowed dimensions and Real, Device and Index types. + */ +template< int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< HeatEquationBuildConfig, Meshes::Grid< Dimension, Real, Device, Index > > + { enum { enabled = ConfigTagDimension< HeatEquationBuildConfig, Dimension >::enabled && + ConfigTagReal< HeatEquationBuildConfig, Real >::enabled && + ConfigTagDevice< HeatEquationBuildConfig, Device >::enabled && + ConfigTagIndex< HeatEquationBuildConfig, Index >::enabled }; }; + +/**** + * Please, chose your preferred time discretization here. + */ +template<> struct ConfigTagTimeDiscretisation< HeatEquationBuildConfig, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< HeatEquationBuildConfig, SemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< HeatEquationBuildConfig, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; + +/**** + * Only the Runge-Kutta-Merson solver is enabled by default. + */ +template<> struct ConfigTagExplicitSolver< HeatEquationBuildConfig, ExplicitEulerSolverTag >{ enum { enabled = false }; }; + +} // namespace Solvers +} // namespace TNL diff --git a/examples/heat-equation/tnl-heat-equation-eoc.h b/examples/heat-equation/tnl-heat-equation-eoc.h index 276763247c2434357e26503635368d30150c2af8..e228a8ca98ed78b49b98537d61945616f82f7c99 100644 --- a/examples/heat-equation/tnl-heat-equation-eoc.h +++ b/examples/heat-equation/tnl-heat-equation-eoc.h @@ -53,17 +53,17 @@ class heatEquationSetter typedef Device DeviceType; typedef Index IndexType; - typedef Containers::StaticVector< MeshType::meshDimensions, Real > Vertex; + typedef Containers::StaticVector< MeshType::meshDimension, Real > Point; static bool run( const Config::ParameterContainer& parameters ) { - enum { Dimensions = MeshType::meshDimensions }; + enum { Dimension = MeshType::meshDimension }; typedef Operators::LinearDiffusion< MeshType, Real, Index > ApproximateOperator; - typedef Operators::ExactLinearDiffusion< Dimensions > ExactOperator; - typedef Functions::TestFunction< MeshType::meshDimensions, Real, Device > TestFunction; + typedef Operators::ExactLinearDiffusion< Dimension > ExactOperator; + typedef Functions::TestFunction< MeshType::meshDimension, Real, Device > TestFunction; typedef HeatEquationEocRhs< ExactOperator, TestFunction > RightHandSide; - typedef Containers::StaticVector < MeshType::meshDimensions, Real > Vertex; - typedef Operators::DirichletBoundaryConditions< MeshType, TestFunction, Dimensions, Real, Index > BoundaryConditions; + typedef Containers::StaticVector < MeshType::meshDimension, Real > Point; + typedef Operators::DirichletBoundaryConditions< MeshType, TestFunction, Dimension, Real, Index > BoundaryConditions; typedef HeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); diff --git a/examples/heat-equation/tnl-heat-equation.h b/examples/heat-equation/tnl-heat-equation.h index bb9de072e09465d93ba8bacdda947cfc474c1438..8fc4cc87b0e78dccdf68156c60fc6a55254452be 100644 --- a/examples/heat-equation/tnl-heat-equation.h +++ b/examples/heat-equation/tnl-heat-equation.h @@ -21,12 +21,14 @@ #include <TNL/Functions/MeshFunction.h> #include <TNL/Problems/HeatEquationProblem.h> #include <TNL/Meshes/Grid.h> +#include "HeatEquationBuildConfigTag.h" using namespace TNL; using namespace TNL::Problems; //typedef tnlDefaultBuildMeshConfig BuildConfig; typedef Solvers::FastBuildConfig BuildConfig; +//typedef Solvers::HeatEquationBuildConfig BuildConfig; template< typename MeshConfig > class heatEquationConfig @@ -66,14 +68,14 @@ class heatEquationSetter static bool run( const Config::ParameterContainer& parameters ) { - enum { Dimensions = MeshType::meshDimensions }; + enum { Dimension = MeshType::meshDimension }; typedef Operators::LinearDiffusion< MeshType, Real, Index > ApproximateOperator; - typedef Functions::Analytic::Constant< Dimensions, Real > RightHandSide; + typedef Functions::Analytic::Constant< Dimension, Real > RightHandSide; String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) { - typedef Functions::Analytic::Constant< Dimensions, Real > Constant; + typedef Functions::Analytic::Constant< Dimension, Real > Constant; if( boundaryConditionsType == "dirichlet" ) { typedef Operators::DirichletBoundaryConditions< MeshType, Constant > BoundaryConditions; diff --git a/examples/inviscid-flow/1d/EulerPressureGetter.h b/examples/inviscid-flow/1d/EulerPressureGetter.h index fc98847a276c165b9352a42767e70e43ec5bcd98..cab92dee240847397ada70cf2cd1808431bb5e97 100644 --- a/examples/inviscid-flow/1d/EulerPressureGetter.h +++ b/examples/inviscid-flow/1d/EulerPressureGetter.h @@ -11,7 +11,7 @@ template< typename Mesh, typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class EulerPressureGetter -: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain > +: public Functions::Domain< Mesh::getMeshDimension(), Functions::MeshDomain > { public: @@ -20,7 +20,7 @@ class EulerPressureGetter typedef Real RealType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); diff --git a/examples/inviscid-flow/1d/EulerVelGetter.h b/examples/inviscid-flow/1d/EulerVelGetter.h index 7e58ae77d6058d27c6e21169603ed09efe68f089..32424aa0e3c22c12592baa2b3c746989da4cc0b1 100644 --- a/examples/inviscid-flow/1d/EulerVelGetter.h +++ b/examples/inviscid-flow/1d/EulerVelGetter.h @@ -10,7 +10,7 @@ template< typename Mesh, typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class EulerVelGetter -: public Functions::Domain< Mesh::getMeshDimensions(), Functions::MeshDomain > +: public Functions::Domain< Mesh::getMeshDimension(), Functions::MeshDomain > { public: @@ -19,7 +19,7 @@ class EulerVelGetter typedef Real RealType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); diff --git a/examples/inviscid-flow/1d/LaxFridrichsContinuity.h b/examples/inviscid-flow/1d/LaxFridrichsContinuity.h index 8053895eda0787a52d12335ad4d9a1acc87e114a..0c86652fa8ec98ba7af0fc6b382c259e3ace3954 100644 --- a/examples/inviscid-flow/1d/LaxFridrichsContinuity.h +++ b/examples/inviscid-flow/1d/LaxFridrichsContinuity.h @@ -27,7 +27,7 @@ class LaxFridrichsContinuity< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Rea typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -81,7 +81,7 @@ class LaxFridrichsContinuity< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Rea typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -136,7 +136,7 @@ class LaxFridrichsContinuity< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Rea typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; diff --git a/examples/inviscid-flow/1d/LaxFridrichsContinuity_impl.h b/examples/inviscid-flow/1d/LaxFridrichsContinuity_impl.h index 3be1a5b6e4cbcdafcab3cf81c55ac51304123a8e..86a2a759a370a85e30383529c9b817a3d2f14e0b 100644 --- a/examples/inviscid-flow/1d/LaxFridrichsContinuity_impl.h +++ b/examples/inviscid-flow/1d/LaxFridrichsContinuity_impl.h @@ -34,15 +34,15 @@ operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time ) const { - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); //rho const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return (0.5 * this->tau) * ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) - 0.5 * hxInverse * ( u[ west ] * this->velocity[ west ] - u[ east ] * this->velocity[ east ] ); } @@ -67,7 +67,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -94,11 +94,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -140,17 +140,17 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse; } @@ -175,7 +175,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -202,14 +202,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -253,20 +253,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -292,7 +292,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -319,17 +319,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/1d/LaxFridrichsEnergy.h b/examples/inviscid-flow/1d/LaxFridrichsEnergy.h index fa0012eb8d006aa452b702c4d0d38eed6b04ccdd..4d60304f7ee19eee98e41ffeac64f6c6b33ef39a 100644 --- a/examples/inviscid-flow/1d/LaxFridrichsEnergy.h +++ b/examples/inviscid-flow/1d/LaxFridrichsEnergy.h @@ -27,7 +27,7 @@ class LaxFridrichsEnergy< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, I typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -87,7 +87,7 @@ class LaxFridrichsEnergy< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, I typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -147,7 +147,7 @@ class LaxFridrichsEnergy< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, I typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; diff --git a/examples/inviscid-flow/1d/LaxFridrichsEnergy_impl.h b/examples/inviscid-flow/1d/LaxFridrichsEnergy_impl.h index ba8092e807211da1470873252ad269c98d69a990..644ef7daf9c0cc1057f5993286904916b0e02c9c 100644 --- a/examples/inviscid-flow/1d/LaxFridrichsEnergy_impl.h +++ b/examples/inviscid-flow/1d/LaxFridrichsEnergy_impl.h @@ -39,15 +39,15 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); //energy const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return (0.5 * this->tau) * ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) - 0.5 * hxInverse * (( u[ west ] + this->pressure[ west ] ) * velocity[ west ] @@ -74,7 +74,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -101,11 +101,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -147,17 +147,17 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse; } @@ -182,7 +182,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -209,14 +209,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -260,20 +260,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -299,7 +299,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -326,17 +326,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/1d/LaxFridrichsMomentum.h b/examples/inviscid-flow/1d/LaxFridrichsMomentum.h index 5bb8818833b32f14415c4d2c107dfe0025d44a7e..429747ad5c1e58a80a016ba207f0bd0f7fa0eaf8 100644 --- a/examples/inviscid-flow/1d/LaxFridrichsMomentum.h +++ b/examples/inviscid-flow/1d/LaxFridrichsMomentum.h @@ -27,7 +27,7 @@ class LaxFridrichsMomentum< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -87,7 +87,7 @@ class LaxFridrichsMomentum< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -147,7 +147,7 @@ class LaxFridrichsMomentum< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; diff --git a/examples/inviscid-flow/1d/LaxFridrichsMomentum_impl.h b/examples/inviscid-flow/1d/LaxFridrichsMomentum_impl.h index 75c7a7fea080bc13201c19dd843f017b8052e4bc..1df79eb812a612fe6649712db58f0d3c733e5b7a 100644 --- a/examples/inviscid-flow/1d/LaxFridrichsMomentum_impl.h +++ b/examples/inviscid-flow/1d/LaxFridrichsMomentum_impl.h @@ -34,15 +34,15 @@ operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time ) const { - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); //rhoVelocity const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return (0.5 * this->tau) * ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) - 0.5 * hxInverse * (( u[ west ] * this -> velocity[ west ] + this -> pressure [ west ] ) @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -142,17 +142,17 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse; } @@ -177,7 +177,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -204,14 +204,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -255,20 +255,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -294,7 +294,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -321,17 +321,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/1d/euler.h b/examples/inviscid-flow/1d/euler.h index 65bf55820659f8ce67d3a1cfd5622e1f558dab72..57fcf5658c0c34315cb0c937595e0d18a882a54d 100644 --- a/examples/inviscid-flow/1d/euler.h +++ b/examples/inviscid-flow/1d/euler.h @@ -66,10 +66,10 @@ class eulerSetter static bool run( const Config::ParameterContainer & parameters ) { - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; typedef LaxFridrichs< MeshType, Real, Index > ApproximateOperator; typedef eulerRhs< MeshType, Real > RightHandSide; - typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex; + typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point; /**** * Resolve the template arguments of your solver here. @@ -79,10 +79,10 @@ class eulerSetter String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) { - typedef Functions::Analytic::Constant< Dimensions, Real > Constant; + typedef Functions::Analytic::Constant< Dimension, Real > Constant; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); @@ -95,7 +95,7 @@ class eulerSetter typedef Functions::MeshFunction< MeshType > MeshFunction; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); diff --git a/examples/inviscid-flow/1d/eulerBuildConfigTag.h b/examples/inviscid-flow/1d/eulerBuildConfigTag.h index abede16343a81cde5e75386f8b2e15117fd6672d..b219ba4ff58c0c6601f7393e93ee395fa18ce6f8 100644 --- a/examples/inviscid-flow/1d/eulerBuildConfigTag.h +++ b/examples/inviscid-flow/1d/eulerBuildConfigTag.h @@ -21,14 +21,14 @@ template<> struct ConfigTagReal< eulerBuildConfigTag, long double > { enum { ena template<> struct ConfigTagIndex< eulerBuildConfigTag, short int >{ enum { enabled = false }; }; template<> struct ConfigTagIndex< eulerBuildConfigTag, long int >{ enum { enabled = false }; }; -template< int Dimensions > struct ConfigTagDimensions< eulerBuildConfigTag, Dimensions >{ enum { enabled = ( Dimensions == 1 ) }; }; +template< int Dimension > struct ConfigTagDimension< eulerBuildConfigTag, Dimension >{ enum { enabled = ( Dimension == 1 ) }; }; /**** * Use of Grid is enabled for allowed dimensions and Real, Device and Index types. */ -template< int Dimensions, typename Real, typename Device, typename Index > - struct ConfigTagMesh< eulerBuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > > - { enum { enabled = ConfigTagDimensions< eulerBuildConfigTag, Dimensions >::enabled && +template< int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< eulerBuildConfigTag, Meshes::Grid< Dimension, Real, Device, Index > > + { enum { enabled = ConfigTagDimension< eulerBuildConfigTag, Dimension >::enabled && ConfigTagReal< eulerBuildConfigTag, Real >::enabled && ConfigTagDevice< eulerBuildConfigTag, Device >::enabled && ConfigTagIndex< eulerBuildConfigTag, Index >::enabled }; }; diff --git a/examples/inviscid-flow/1d/eulerProblem_impl.h b/examples/inviscid-flow/1d/eulerProblem_impl.h index 43e45d6693c7a8963d334030c266498dae3b3761..8d690994edefde937f856f1a3e075a6b123e2582 100644 --- a/examples/inviscid-flow/1d/eulerProblem_impl.h +++ b/examples/inviscid-flow/1d/eulerProblem_impl.h @@ -168,17 +168,17 @@ setupLinearSystem( const MeshPointer& mesh, Matrix& matrix ) { /* const IndexType dofs = this->getDofs( mesh ); - typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; - CompressedRowsLengthsVectorType rowLengths; + typedef typename Matrix::CompressedRowLengthsVector CompressedRowLengthsVectorType; + CompressedRowLengthsVectorType rowLengths; if( ! rowLengths.setSize( dofs ) ) return false; - MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; - matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh, + MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter; + matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( mesh, differentialOperator, boundaryCondition, rowLengths ); matrix.setDimensions( dofs, dofs ); - if( ! matrix.setCompressedRowsLengths( rowLengths ) ) + if( ! matrix.setCompressedRowLengths( rowLengths ) ) return false;*/ return true; } @@ -297,13 +297,10 @@ getExplicitUpdate( const RealType& time, lF1DMomentum->setVelocity( *velocity); lF1DMomentum->setPressure( *pressure); Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Momentum, BoundaryCondition, RightHandSide > explicitUpdaterMomentum; - explicitUpdaterMomentum.template update< typename Mesh::Cell >( time, - mesh, - lF1DMomentum, - this->boundaryConditionsPointer, - this->rightHandSidePointer, - uRhoVelocity, - fuRhoVelocity ); + explicitUpdaterMomentum.setDifferentialOperator( lF1DMomentum ); + explicitUpdaterMomentum.setBoundaryConditions( this->boundaryConditionsPointer ); + explicitUpdaterMomentum.setRightHandSide( this->rightHandSidePointer ); + explicitUpdaterMomentum.template update< typename Mesh::Cell >( time, tau, mesh, uRhoVelocity, fuRhoVelocity ); std::cout << "explicitRHSenergy" << std::endl; //energy @@ -311,13 +308,11 @@ getExplicitUpdate( const RealType& time, lF1DEnergy->setPressure( *pressure); lF1DEnergy->setVelocity( *velocity); Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy; - explicitUpdaterEnergy.template update< typename Mesh::Cell >( time, - mesh, - lF1DEnergy, - this->boundaryConditionsPointer, - this->rightHandSidePointer, - uEnergy, - fuEnergy ); + explicitUpdaterEnergy.setDifferentialOperator( lF1DEnergy ); + explicitUpdaterEnergy.setBoundaryConditions( this->boundaryConditionsPointer ); + explicitUpdaterEnergy.setRightHandSide( this->rightHandSidePointer ); + + explicitUpdaterEnergy.template update< typename Mesh::Cell >( time, tau, mesh, uEnergy, fuEnergy ); } diff --git a/examples/inviscid-flow/1d/eulerRhs.h b/examples/inviscid-flow/1d/eulerRhs.h index 1b46dc831fe9daa6133ff32ee4bea5faf4eb8d1c..97dc9f07b391dc52020094be9d9eed279cbd1562 100644 --- a/examples/inviscid-flow/1d/eulerRhs.h +++ b/examples/inviscid-flow/1d/eulerRhs.h @@ -6,7 +6,7 @@ namespace TNL { template< typename Mesh, typename Real >class eulerRhs - : public Functions::Domain< Mesh::meshDimensions, Functions::MeshDomain > + : public Functions::Domain< Mesh::meshDimension, Functions::MeshDomain > { public: @@ -24,8 +24,8 @@ template< typename Mesh, typename Real >class eulerRhs Real operator()( const MeshEntity& entity, const Real& time = 0.0 ) const { - typedef typename MeshEntity::MeshType::VertexType VertexType; - VertexType v = entity.getCenter(); + typedef typename MeshEntity::MeshType::PointType PointType; + PointType v = entity.getCenter(); return 0.0; } }; diff --git a/examples/inviscid-flow/2d/EulerPressureGetter.h b/examples/inviscid-flow/2d/EulerPressureGetter.h index 49e50d72576c270dc1f94f661aae70444ca00677..3a73c8241ee05184ee72d5aea2869bcc18d3c45b 100644 --- a/examples/inviscid-flow/2d/EulerPressureGetter.h +++ b/examples/inviscid-flow/2d/EulerPressureGetter.h @@ -27,7 +27,7 @@ class EulerPressureGetter< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real gamma; @@ -94,7 +94,7 @@ class EulerPressureGetter< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real gamma; @@ -161,7 +161,7 @@ class EulerPressureGetter< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real gamma; diff --git a/examples/inviscid-flow/2d/EulerPressureGetter_impl.h b/examples/inviscid-flow/2d/EulerPressureGetter_impl.h index 7d6b9310df3ddd19fbb261d7eb8dca00b72c82b9..07d61f383a00c6b71cb0607d17311ed90458aa5f 100644 --- a/examples/inviscid-flow/2d/EulerPressureGetter_impl.h +++ b/examples/inviscid-flow/2d/EulerPressureGetter_impl.h @@ -39,13 +39,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -168,7 +168,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -195,14 +195,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -246,20 +246,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -285,7 +285,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -312,17 +312,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/EulerVelGetter.h b/examples/inviscid-flow/2d/EulerVelGetter.h index 2da0052b87492d6dd27a2b6def5fa3ead42318fa..d913664bde12bdecbf804d163038d07638e73ce7 100644 --- a/examples/inviscid-flow/2d/EulerVelGetter.h +++ b/examples/inviscid-flow/2d/EulerVelGetter.h @@ -29,7 +29,7 @@ class EulerVelGetter< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType velX; @@ -84,7 +84,7 @@ class EulerVelGetter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType velX; @@ -139,7 +139,7 @@ class EulerVelGetter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType velX; diff --git a/examples/inviscid-flow/2d/EulerVelGetter_impl.h b/examples/inviscid-flow/2d/EulerVelGetter_impl.h index eeac07e57011bac7bd9769de63687f2f9bbc0852..17d4c8a4ef1760eea919c08a1af6990d84f2b932 100644 --- a/examples/inviscid-flow/2d/EulerVelGetter_impl.h +++ b/examples/inviscid-flow/2d/EulerVelGetter_impl.h @@ -39,13 +39,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -142,9 +142,9 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); //vel const IndexType& center = entity.getIndex(); return ::sqrt(pow( velX[ center ],2)+pow( velY[ center ],2)); @@ -170,7 +170,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -197,14 +197,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -248,20 +248,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -287,7 +287,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -314,17 +314,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/EulerVelXGetter.h b/examples/inviscid-flow/2d/EulerVelXGetter.h index 93e3363bfab2f2d7eca6b375d9013c661bd47427..f7d8f5f7180f6f0ba65c40e43011d636c5482f52 100644 --- a/examples/inviscid-flow/2d/EulerVelXGetter.h +++ b/examples/inviscid-flow/2d/EulerVelXGetter.h @@ -27,7 +27,7 @@ class EulerVelXGetter< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType rhoVelX; @@ -82,7 +82,7 @@ class EulerVelXGetter< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType rhoVelX; @@ -136,7 +136,7 @@ class EulerVelXGetter< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType rhoVelX; diff --git a/examples/inviscid-flow/2d/EulerVelXGetter_impl.h b/examples/inviscid-flow/2d/EulerVelXGetter_impl.h index 6008509056afbadfbd99dddc3c0a57bad4185b28..eee5a63b51ca1743c944333c564357ac00dd3f28 100644 --- a/examples/inviscid-flow/2d/EulerVelXGetter_impl.h +++ b/examples/inviscid-flow/2d/EulerVelXGetter_impl.h @@ -38,13 +38,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -68,7 +68,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -95,11 +95,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -141,9 +141,9 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); //velX const IndexType& center = entity.getIndex(); return ( rhoVelX[ center ] / rho[ center ]); @@ -169,7 +169,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -196,14 +196,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -247,20 +247,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -286,7 +286,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -313,17 +313,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/EulerVelYGetter.h b/examples/inviscid-flow/2d/EulerVelYGetter.h index 49474808d38d60baa3a0625ca690b953f714c5c7..62ecc39a0d361cd51e1f739746d992df2bc40176 100644 --- a/examples/inviscid-flow/2d/EulerVelYGetter.h +++ b/examples/inviscid-flow/2d/EulerVelYGetter.h @@ -27,7 +27,7 @@ class EulerVelYGetter< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType rhoVelY; @@ -81,7 +81,7 @@ class EulerVelYGetter< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType rhoVelY; @@ -135,7 +135,7 @@ class EulerVelYGetter< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Inde typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); MeshFunctionType rhoVelY; diff --git a/examples/inviscid-flow/2d/EulerVelYGetter_impl.h b/examples/inviscid-flow/2d/EulerVelYGetter_impl.h index 337f4208c3ee6c0feef0e77e4d136b7704113671..d73d3a42b1ed581f8b62ce45becbaaf563f8d5a2 100644 --- a/examples/inviscid-flow/2d/EulerVelYGetter_impl.h +++ b/examples/inviscid-flow/2d/EulerVelYGetter_impl.h @@ -39,13 +39,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -162,7 +162,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -189,14 +189,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -240,20 +240,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -279,7 +279,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -306,17 +306,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/LaxFridrichsContinuity.h b/examples/inviscid-flow/2d/LaxFridrichsContinuity.h index 433d6a3512cbd8493ac16d0181d2255bb7692974..3b212e97009c3d3e2c58e1d305482dd777ef6de1 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsContinuity.h +++ b/examples/inviscid-flow/2d/LaxFridrichsContinuity.h @@ -27,7 +27,7 @@ class LaxFridrichsContinuity< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Rea typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -88,7 +88,7 @@ class LaxFridrichsContinuity< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Rea typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -149,7 +149,7 @@ class LaxFridrichsContinuity< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Rea typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; diff --git a/examples/inviscid-flow/2d/LaxFridrichsContinuity_impl .h b/examples/inviscid-flow/2d/LaxFridrichsContinuity_impl .h index 237b1a5845614a16ec708cf495ad057b297830b2..4a58138a9009f39f2b57a4ddbacb3cd8c85f6104 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsContinuity_impl .h +++ b/examples/inviscid-flow/2d/LaxFridrichsContinuity_impl .h @@ -39,13 +39,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -142,18 +142,18 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); //rho const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return (0.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) - 0.5 * hxInverse * ( u[ west ] * this->velocityX[ west ] - u[ east ] * this->velocityX[ east ] ) - 0.5 * hyInverse * ( u[ north ] * this->velocityY[ north ] - u[ south ] * this->velocityY[ east ] ); @@ -179,7 +179,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -206,14 +206,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -257,20 +257,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -296,7 +296,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -323,17 +323,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/LaxFridrichsEnergy.h b/examples/inviscid-flow/2d/LaxFridrichsEnergy.h index 8685697295d485d03c57e3748d2b6320e84f3ac5..ed6376316fdbb884d0f358c0ff558e83cde5dd3c 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsEnergy.h +++ b/examples/inviscid-flow/2d/LaxFridrichsEnergy.h @@ -27,7 +27,7 @@ class LaxFridrichsEnergy< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, I typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -93,7 +93,7 @@ class LaxFridrichsEnergy< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, I typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -159,7 +159,7 @@ class LaxFridrichsEnergy< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, I typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; diff --git a/examples/inviscid-flow/2d/LaxFridrichsEnergy_impl.h b/examples/inviscid-flow/2d/LaxFridrichsEnergy_impl.h index e4f9b2e176d9acdb50157c6cf5f77a6c86801dd8..738c8fc793eb849e93c860b03ba63a37105c69fd 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsEnergy_impl.h +++ b/examples/inviscid-flow/2d/LaxFridrichsEnergy_impl.h @@ -39,13 +39,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -142,17 +142,17 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); //energy const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return (0.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) - 0.5 * hxInverse * ((( u[ west ] + this->pressure[ west ] ) * this->velocityX[ west ] ) -(( u[ east ] + this->pressure[ east ] ) * this->velocityX[ east ] )) @@ -180,7 +180,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -207,14 +207,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -258,20 +258,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -297,7 +297,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -324,17 +324,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumX.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumX.h index b82758fc7c24cebfcc08580d73c0fd142a82dedc..d5253d6115d84bd512bf031b2177f2dccb70481f 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsMomentumX.h +++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumX.h @@ -27,7 +27,7 @@ class LaxFridrichsMomentumX< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -94,7 +94,7 @@ class LaxFridrichsMomentumX< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -160,7 +160,7 @@ class LaxFridrichsMomentumX< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumX_impl.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumX_impl.h index bffb1fe02b4bdc505cb2214954a159f4b8f141bc..90af83ddace740a86a827bed419fc4b6ff742d15 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsMomentumX_impl.h +++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumX_impl.h @@ -39,13 +39,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -142,18 +142,18 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); //rhoVelX const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return (0.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) - 0.5 * hxInverse * (( u[ west ] * this->velocityX[ west ] + this->pressure[ west ] ) -( u[ east ] * this->velocityX[ east ] + this->pressure[ east ] )) @@ -181,7 +181,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -208,14 +208,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -259,20 +259,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -298,7 +298,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -325,17 +325,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumY.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumY.h index 309051829f7b973ed3009ae12eef2c8ec425f647..83d716bf89709389ed11a61cfd15fe54b8d1acb2 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsMomentumY.h +++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumY.h @@ -27,7 +27,7 @@ class LaxFridrichsMomentumY< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -93,7 +93,7 @@ class LaxFridrichsMomentumY< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; @@ -159,7 +159,7 @@ class LaxFridrichsMomentumY< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); Real tau; diff --git a/examples/inviscid-flow/2d/LaxFridrichsMomentumY_impl.h b/examples/inviscid-flow/2d/LaxFridrichsMomentumY_impl.h index 0624e19aa88750ceb7c78f940b287e515e34ee45..a7bc944ef8235e3860d4c4ca3a9d8b36d563644f 100644 --- a/examples/inviscid-flow/2d/LaxFridrichsMomentumY_impl.h +++ b/examples/inviscid-flow/2d/LaxFridrichsMomentumY_impl.h @@ -39,13 +39,13 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -69,7 +69,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -96,11 +96,11 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -142,18 +142,18 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); //rhoVelY const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return (0.5 * this->tau) * ( u[ west ] + u[ east ] + u[ south ] + u[ north ] - 4.0 * u[ center ] ) - 0.5 * hyInverse * (( u[ west ] * this->velocityX[ west ] ) -( u[ east ] * this->velocityX[ east ] )) @@ -181,7 +181,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -208,14 +208,14 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -259,20 +259,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -298,7 +298,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -325,17 +325,17 @@ updateLinearSystem( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/examples/inviscid-flow/2d/euler.h b/examples/inviscid-flow/2d/euler.h index a888f928e86227dd3126c32408ba69fe46c89b7d..2375f1095bd794d93d900c7eb84b358f74c87e5c 100644 --- a/examples/inviscid-flow/2d/euler.h +++ b/examples/inviscid-flow/2d/euler.h @@ -67,10 +67,10 @@ class eulerSetter static bool run( const Config::ParameterContainer & parameters ) { - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; typedef LaxFridrichs< MeshType, Real, Index > ApproximateOperator; typedef eulerRhs< MeshType, Real > RightHandSide; - typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex; + typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point; /**** * Resolve the template arguments of your solver here. @@ -80,10 +80,10 @@ class eulerSetter String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) { - typedef Functions::Analytic::Constant< Dimensions, Real > Constant; + typedef Functions::Analytic::Constant< Dimension, Real > Constant; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); @@ -96,7 +96,7 @@ class eulerSetter typedef Functions::MeshFunction< MeshType > MeshFunction; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef eulerProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); diff --git a/examples/inviscid-flow/2d/eulerBuildConfigTag.h b/examples/inviscid-flow/2d/eulerBuildConfigTag.h index fef4dfffce5400b1ef97786bc92b8a57ac246c1d..810be65037365dd2693f8eff05820620c609c3de 100644 --- a/examples/inviscid-flow/2d/eulerBuildConfigTag.h +++ b/examples/inviscid-flow/2d/eulerBuildConfigTag.h @@ -21,14 +21,14 @@ template<> struct ConfigTagReal< eulerBuildConfigTag, long double > { enum { ena template<> struct ConfigTagIndex< eulerBuildConfigTag, short int >{ enum { enabled = false }; }; template<> struct ConfigTagIndex< eulerBuildConfigTag, long int >{ enum { enabled = false }; }; -template< int Dimensions > struct ConfigTagDimensions< eulerBuildConfigTag, Dimensions >{ enum { enabled = ( Dimensions == 2 ) }; }; +template< int Dimension > struct ConfigTagDimension< eulerBuildConfigTag, Dimension >{ enum { enabled = ( Dimension == 2 ) }; }; /**** * Use of Grid is enabled for allowed dimensions and Real, Device and Index types. */ -template< int Dimensions, typename Real, typename Device, typename Index > - struct ConfigTagMesh< eulerBuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > > - { enum { enabled = ConfigTagDimensions< eulerBuildConfigTag, Dimensions >::enabled && +template< int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< eulerBuildConfigTag, Meshes::Grid< Dimension, Real, Device, Index > > + { enum { enabled = ConfigTagDimension< eulerBuildConfigTag, Dimension >::enabled && ConfigTagReal< eulerBuildConfigTag, Real >::enabled && ConfigTagDevice< eulerBuildConfigTag, Device >::enabled && ConfigTagIndex< eulerBuildConfigTag, Index >::enabled }; }; diff --git a/examples/inviscid-flow/2d/eulerProblem_impl.h b/examples/inviscid-flow/2d/eulerProblem_impl.h index 7b5fc93f8389a0808d454eb5a5f238e5f29699cf..1a054dcc811c513ebf9ca8a5dad6f7f150006e86 100644 --- a/examples/inviscid-flow/2d/eulerProblem_impl.h +++ b/examples/inviscid-flow/2d/eulerProblem_impl.h @@ -169,17 +169,17 @@ setupLinearSystem( const MeshPointer& mesh, Matrix& matrix ) { /* const IndexType dofs = this->getDofs( mesh ); - typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; - CompressedRowsLengthsVectorType rowLengths; + typedef typename Matrix::CompressedRowLengthsVector CompressedRowLengthsVectorType; + CompressedRowLengthsVectorType rowLengths; if( ! rowLengths.setSize( dofs ) ) return false; - MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; - matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh, + MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter; + matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( mesh, differentialOperator, boundaryCondition, rowLengths ); matrix.setDimensions( dofs, dofs ); - if( ! matrix.setCompressedRowsLengths( rowLengths ) ) + if( ! matrix.setCompressedRowLengths( rowLengths ) ) return false;*/ return true; } @@ -280,13 +280,10 @@ getExplicitUpdate( const RealType& time, lF2DContinuity->setVelocityX( *velocityX ); lF2DContinuity->setVelocityY( *velocityY ); Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity; - explicitUpdaterContinuity.template update< typename Mesh::Cell >( time, - mesh, - lF2DContinuity, - this->boundaryConditionPointer, - this->rightHandSidePointer, - uRho, - fuRho ); + explicitUpdaterContinuity.setDifferentialOperator( lF2DContinuity ); + explicitUpdaterContinuity.setBoundaryConditions( this->boundaryConditionPointer ); + explicitUpdaterContinuity.setRightHandSide( this->rightHandSidePointer ); + explicitUpdaterContinuity.template update< typename Mesh::Cell >( time, tau, mesh, uRho, fuRho ); //rhoVelocityX lF2DMomentumX->setTau(tau); @@ -294,13 +291,10 @@ getExplicitUpdate( const RealType& time, lF2DMomentumX->setVelocityY( *velocityY ); lF2DMomentumX->setPressure( *pressure ); Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumX, BoundaryCondition, RightHandSide > explicitUpdaterMomentumX; - explicitUpdaterMomentumX.template update< typename Mesh::Cell >( time, - mesh, - lF2DMomentumX, - this->boundaryConditionPointer, - this->rightHandSidePointer, - uRhoVelocityX, - fuRhoVelocityX ); + explicitUpdaterMomentumX.setDifferentialOperator( lF2DMomentumX ); + explicitUpdaterMomentumX.setBoundaryConditions( this->boundaryConditionPointer ); + explicitUpdaterMomentumX.setRightHandSide( this->rightHandSidePointer ); + explicitUpdaterMomentumX.template update< typename Mesh::Cell >( time, tau, mesh, uRhoVelocityX, fuRhoVelocityX ); //rhoVelocityY lF2DMomentumY->setTau(tau); @@ -308,13 +302,10 @@ getExplicitUpdate( const RealType& time, lF2DMomentumY->setVelocityY( *velocityY ); lF2DMomentumY->setPressure( *pressure ); Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, MomentumY, BoundaryCondition, RightHandSide > explicitUpdaterMomentumY; - explicitUpdaterMomentumY.template update< typename Mesh::Cell >( time, - mesh, - lF2DMomentumY, - this->boundaryConditionPointer, - this->rightHandSidePointer, - uRhoVelocityY, - fuRhoVelocityY ); + explicitUpdaterMomentumY.setDifferentialOperator( lF2DMomentumY ); + explicitUpdaterMomentumY.setBoundaryConditions( this->boundaryConditionPointer ); + explicitUpdaterMomentumY.setRightHandSide( this->rightHandSidePointer ); + explicitUpdaterMomentumY.template update< typename Mesh::Cell >( time, tau, mesh, uRhoVelocityY, fuRhoVelocityY ); //energy lF2DEnergy->setTau(tau); @@ -322,21 +313,12 @@ getExplicitUpdate( const RealType& time, lF2DEnergy->setVelocityY( *velocityY ); lF2DEnergy->setPressure( *pressure ); Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy; - explicitUpdaterEnergy.template update< typename Mesh::Cell >( time, - mesh, - lF2DEnergy, - this->boundaryConditionPointer, - this->rightHandSidePointer, - uEnergy, - fuEnergy ); + explicitUpdaterEnergy.setDifferentialOperator( lF2DEnergy ); + explicitUpdaterEnergy.setBoundaryConditions( this->boundaryConditionPointer ); + explicitUpdaterEnergy.setRightHandSide( this->rightHandSidePointer ); + explicitUpdaterEnergy.template update< typename Mesh::Cell >( time, tau, mesh, uEnergy, fuEnergy ); -/* - BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; - boundaryConditionsSetter.template apply< typename Mesh::Cell >( - this->boundaryCondition, - time + tau, - u );*/ - } +} template< typename Mesh, typename BoundaryCondition, @@ -433,7 +415,7 @@ postIterate( const RealType& time, euler2DPressure.setRho(uRho); // OperatorFunction< euler2DPressure, MeshFunction, void, time > OFPressure; // pressure = OFPressure; - + return true; } } // namespace TNL diff --git a/examples/inviscid-flow/2d/eulerRhs.h b/examples/inviscid-flow/2d/eulerRhs.h index 1b46dc831fe9daa6133ff32ee4bea5faf4eb8d1c..97dc9f07b391dc52020094be9d9eed279cbd1562 100644 --- a/examples/inviscid-flow/2d/eulerRhs.h +++ b/examples/inviscid-flow/2d/eulerRhs.h @@ -6,7 +6,7 @@ namespace TNL { template< typename Mesh, typename Real >class eulerRhs - : public Functions::Domain< Mesh::meshDimensions, Functions::MeshDomain > + : public Functions::Domain< Mesh::meshDimension, Functions::MeshDomain > { public: @@ -24,8 +24,8 @@ template< typename Mesh, typename Real >class eulerRhs Real operator()( const MeshEntity& entity, const Real& time = 0.0 ) const { - typedef typename MeshEntity::MeshType::VertexType VertexType; - VertexType v = entity.getCenter(); + typedef typename MeshEntity::MeshType::PointType PointType; + PointType v = entity.getCenter(); return 0.0; } }; diff --git a/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.h b/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.h index a1dfe65f3416cae2039a4e44c1ccc91f13d5b4b1..f978f811af95fb7d5f66150e95cf8b8acff103e0 100644 --- a/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.h +++ b/examples/mean-curvature-flow/tnl-mean-curvature-flow-eoc.h @@ -69,8 +69,8 @@ class meanCurvatureFlowEocSetter typedef Device DeviceType; typedef Index IndexType; - typedef typename MeshType::VertexType Vertex; - enum { Dimensions = MeshType::meshDimensions }; + typedef typename MeshType::PointType Point; + enum { Dimension = MeshType::meshDimension }; static bool run( const Config::ParameterContainer& parameters ) { @@ -78,11 +78,11 @@ class meanCurvatureFlowEocSetter typedef tnlFiniteVolumeOperatorQ<MeshType, Real, Index, 0> OperatorQ; typedef FiniteVolumeNonlinearOperator<MeshType, OperatorQ, Real, Index > NonlinearOperator; typedef NonlinearDiffusion< MeshType, NonlinearOperator, Real, Index > ApproximateOperator; - typedef ExactNonlinearDiffusion< ExactGradientNorm< Dimensions >, Dimensions > ExactOperator; - typedef TestFunction< MeshType::meshDimensions, Real, Device > TestFunction; - typedef MeanCurvatureFlowEocRhs< ExactOperator, TestFunction, Dimensions > RightHandSide; - typedef StaticVector < MeshType::meshDimensions, Real > Vertex; - typedef DirichletBoundaryConditions< MeshType, TestFunction, Dimensions, Real, Index > BoundaryConditions; + typedef ExactNonlinearDiffusion< ExactGradientNorm< Dimension >, Dimension > ExactOperator; + typedef TestFunction< MeshType::meshDimension, Real, Device > TestFunction; + typedef MeanCurvatureFlowEocRhs< ExactOperator, TestFunction, Dimension > RightHandSide; + typedef StaticVector < MeshType::meshDimension, Real > Point; + typedef DirichletBoundaryConditions< MeshType, TestFunction, Dimension, Real, Index > BoundaryConditions; typedef MeanCurvatureFlowEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); diff --git a/examples/mean-curvature-flow/tnl-mean-curvature-flow.h b/examples/mean-curvature-flow/tnl-mean-curvature-flow.h index 7a284907c171e7b413a87e4103fa497c42553799..6a28b84210db9432d0b302b9f7f09aee6b160869 100644 --- a/examples/mean-curvature-flow/tnl-mean-curvature-flow.h +++ b/examples/mean-curvature-flow/tnl-mean-curvature-flow.h @@ -70,8 +70,8 @@ class meanCurvatureFlowSetter typedef Device DeviceType; typedef Index IndexType; - typedef typename MeshType::VertexType Vertex; - enum { Dimensions = MeshType::meshDimensions }; + typedef typename MeshType::PointType Point; + enum { Dimension = MeshType::meshDimension }; static bool run( const Config::ParameterContainer& parameters ) { @@ -101,16 +101,16 @@ class meanCurvatureFlowSetter static bool setBoundaryConditions( const Config::ParameterContainer& parameters ) { typedef OneSidedNonlinearDiffusion< MeshType, NonlinearOperator, Real, Index > ApproximateOperator; - typedef Constant< Dimensions, Real > RightHandSide; - typedef StaticVector< MeshType::meshDimensions, Real > Vertex; + typedef Constant< Dimension, Real > RightHandSide; + typedef StaticVector< MeshType::meshDimension, Real > Point; String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) { - typedef Constant< Dimensions, Real > Constant; + typedef Constant< Dimension, Real > Constant; if( boundaryConditionsType == "dirichlet" ) { - typedef DirichletBoundaryConditions< MeshType, Constant, Dimensions, Real, Index > BoundaryConditions; + typedef DirichletBoundaryConditions< MeshType, Constant, Dimension, Real, Index > BoundaryConditions; typedef MeanCurvatureFlowProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); @@ -124,7 +124,7 @@ class meanCurvatureFlowSetter typedef Functions::MeshFunction< MeshType > MeshFunction; if( boundaryConditionsType == "dirichlet" ) { - typedef DirichletBoundaryConditions< MeshType, MeshFunction, Dimensions, Real, Index > BoundaryConditions; + typedef DirichletBoundaryConditions< MeshType, MeshFunction, Dimension, Real, Index > BoundaryConditions; typedef MeanCurvatureFlowProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); diff --git a/src/TNL/Containers/MultiArray.h b/src/TNL/Containers/MultiArray.h index b062fb605109691bdb3e18ca3dbfe4b6a31f8ddd..1aabf733bd3bae912818eb1768c39a2b28402c76 100644 --- a/src/TNL/Containers/MultiArray.h +++ b/src/TNL/Containers/MultiArray.h @@ -18,7 +18,7 @@ namespace TNL { namespace Containers { -template< int Dimensions, typename Element = double, typename Device = Devices::Host, typename Index = int > +template< int Dimension, typename Element = double, typename Device = Devices::Host, typename Index = int > class MultiArray : public Array< Element, Device, Index > { }; @@ -27,7 +27,7 @@ template< typename Element, typename Device, typename Index > class MultiArray< 1, Element, Device, Index > : public Array< Element, Device, Index > { public: - enum { Dimensions = 1}; + enum { Dimension = 1}; typedef Element ElementType; typedef Device DeviceType; typedef Index IndexType; @@ -106,7 +106,7 @@ template< typename Element, typename Device, typename Index > class MultiArray< 2, Element, Device, Index > : public Array< Element, Device, Index > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; typedef Element ElementType; typedef Device DeviceType; typedef Index IndexType; @@ -189,7 +189,7 @@ class MultiArray< 3, Element, Device, Index > : public Array< Element, Device, I { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; typedef Element ElementType; typedef Device DeviceType; typedef Index IndexType; @@ -272,7 +272,7 @@ class MultiArray< 4, Element, Device, Index > : public Array< Element, Device, I { public: - enum { Dimensions = 4 }; + enum { Dimension = 4 }; typedef Element ElementType; typedef Device DeviceType; typedef Index IndexType; diff --git a/src/TNL/Containers/MultiArray1D_impl.h b/src/TNL/Containers/MultiArray1D_impl.h index ee57a53f085393c216bdbf2a53993b44322efb05..ec64e060053a57cbfbcae0240961df0619fc4d79 100644 --- a/src/TNL/Containers/MultiArray1D_impl.h +++ b/src/TNL/Containers/MultiArray1D_impl.h @@ -22,7 +22,7 @@ template< typename Element, typename Device, typename Index > String MultiArray< 1, Element, Device, Index > :: getType() { return String( "Containers::MultiArray< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Element >() ) + String( ", " ) + diff --git a/src/TNL/Containers/MultiArray2D_impl.h b/src/TNL/Containers/MultiArray2D_impl.h index cf67c102217186283c8d546211036d75251b9d8e..cbaca350a01a8a84fdac2924c01c137610941597 100644 --- a/src/TNL/Containers/MultiArray2D_impl.h +++ b/src/TNL/Containers/MultiArray2D_impl.h @@ -22,7 +22,7 @@ template< typename Element, typename Device, typename Index > String MultiArray< 2, Element, Device, Index > :: getType() { return String( "Containers::MultiArray< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Element >() ) + String( ", " ) + diff --git a/src/TNL/Containers/MultiArray3D_impl.h b/src/TNL/Containers/MultiArray3D_impl.h index 633f67a798df8f4e657049e5e236a107da548a3a..750efab1b71834ab058744b8eb081a4f4ed21396 100644 --- a/src/TNL/Containers/MultiArray3D_impl.h +++ b/src/TNL/Containers/MultiArray3D_impl.h @@ -22,7 +22,7 @@ template< typename Element, typename Device, typename Index > String MultiArray< 3, Element, Device, Index > :: getType() { return String( "Containers::MultiArray< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Element >() ) + String( ", " ) + diff --git a/src/TNL/Containers/MultiArray4D_impl.h b/src/TNL/Containers/MultiArray4D_impl.h index cb513418a339d9ce812b3f7f849390f0705a43cc..5f022247c086461bb11786fda96e4e90f25d7b42 100644 --- a/src/TNL/Containers/MultiArray4D_impl.h +++ b/src/TNL/Containers/MultiArray4D_impl.h @@ -23,7 +23,7 @@ template< typename Element, typename Device, typename Index > String MultiArray< 4, Element, Device, Index > :: getType() { return String( "Containers::MultiArray< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Element >() ) + String( ", " ) + diff --git a/src/TNL/Containers/MultiVector.h b/src/TNL/Containers/MultiVector.h index ecd64f69f3fcb94e5058e9c124cfc6c56a7435dd..fd89f2c40cbf054ba484d01782ca5d1e1801efd6 100644 --- a/src/TNL/Containers/MultiVector.h +++ b/src/TNL/Containers/MultiVector.h @@ -17,7 +17,7 @@ namespace TNL { namespace Containers { -template< int Dimensions, typename Real = double, typename Device = Devices::Host, typename Index = int > +template< int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int > class MultiVector : public Vector< Real, Device, Index > { }; @@ -26,12 +26,12 @@ template< typename Real, typename Device, typename Index > class MultiVector< 1, Real, Device, Index > : public Vector< Real, Device, Index > { public: - enum { Dimensions = 1}; + enum { Dimension = 1}; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef MultiVector< Dimensions, Real, Devices::Host, Index > HostType; - typedef MultiVector< Dimensions, Real, Devices::Cuda, Index > CudaType; + typedef MultiVector< Dimension, Real, Devices::Host, Index > HostType; + typedef MultiVector< Dimension, Real, Devices::Cuda, Index > CudaType; MultiVector(); @@ -47,7 +47,7 @@ class MultiVector< 1, Real, Device, Index > : public Vector< Real, Device, Index bool setDimensions( const Index iSize ); - bool setDimensions( const StaticVector< Dimensions, Index >& dimensions ); + bool setDimensions( const StaticVector< Dimension, Index >& dimensions ); void getDimensions( Index& iSize ) const; @@ -100,19 +100,19 @@ class MultiVector< 1, Real, Device, Index > : public Vector< Real, Device, Index protected: - StaticVector< Dimensions, Index > dimensions; + StaticVector< Dimension, Index > dimensions; }; template< typename Real, typename Device, typename Index > class MultiVector< 2, Real, Device, Index > : public Vector< Real, Device, Index > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef MultiVector< Dimensions, Real, Devices::Host, Index > HostType; - typedef MultiVector< Dimensions, Real, Devices::Cuda, Index > CudaType; + typedef MultiVector< Dimension, Real, Devices::Host, Index > HostType; + typedef MultiVector< Dimension, Real, Devices::Cuda, Index > CudaType; MultiVector(); @@ -189,12 +189,12 @@ class MultiVector< 3, Real, Device, Index > : public Vector< Real, Device, Index { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef MultiVector< Dimensions, Real, Devices::Host, Index > HostType; - typedef MultiVector< Dimensions, Real, Devices::Cuda, Index > CudaType; + typedef MultiVector< Dimension, Real, Devices::Host, Index > HostType; + typedef MultiVector< Dimension, Real, Devices::Cuda, Index > CudaType; MultiVector(); @@ -271,12 +271,12 @@ class MultiVector< 4, Real, Device, Index > : public Vector< Real, Device, Index { public: - enum { Dimensions = 4 }; + enum { Dimension = 4 }; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef MultiVector< Dimensions, Real, Devices::Host, Index > HostType; - typedef MultiVector< Dimensions, Real, Devices::Cuda, Index > CudaType; + typedef MultiVector< Dimension, Real, Devices::Host, Index > HostType; + typedef MultiVector< Dimension, Real, Devices::Cuda, Index > CudaType; MultiVector(); diff --git a/src/TNL/Containers/MultiVector1D_impl.h b/src/TNL/Containers/MultiVector1D_impl.h index 2bbaf6bea36c66b6bebe2d20a02ea4ba1b78492e..93ee232f34c6331d716982f4be4e2358fe776050 100644 --- a/src/TNL/Containers/MultiVector1D_impl.h +++ b/src/TNL/Containers/MultiVector1D_impl.h @@ -22,7 +22,7 @@ template< typename Real, typename Device, typename Index > String MultiVector< 1, Real, Device, Index > :: getType() { return String( "Containers::MultiVector< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Real >() ) + String( ", " ) + @@ -66,7 +66,7 @@ bool MultiVector< 1, Real, Device, Index > :: setDimensions( const Index iSize ) } template< typename Real, typename Device, typename Index > -bool MultiVector< 1, Real, Device, Index > :: setDimensions( const StaticVector< Dimensions, Index >& dimensions ) +bool MultiVector< 1, Real, Device, Index > :: setDimensions( const StaticVector< Dimension, Index >& dimensions ) { TNL_ASSERT( dimensions[ 0 ] > 0, std::cerr << " dimensions[ 0 ] = " << dimensions[ 0 ] ); diff --git a/src/TNL/Containers/MultiVector2D_impl.h b/src/TNL/Containers/MultiVector2D_impl.h index 510ef51b576ef9b5058f9ccad7407f3c3746c480..0abbd6cc04bf19e1b3b5402d7a57d73219a30db7 100644 --- a/src/TNL/Containers/MultiVector2D_impl.h +++ b/src/TNL/Containers/MultiVector2D_impl.h @@ -22,7 +22,7 @@ template< typename Real, typename Device, typename Index > String MultiVector< 2, Real, Device, Index > :: getType() { return String( "Containers::MultiVector< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Real >() ) + String( ", " ) + diff --git a/src/TNL/Containers/MultiVector3D_impl.h b/src/TNL/Containers/MultiVector3D_impl.h index 3fa6b6dd30fca392a6adc5372fa76b5df37aa535..0ee9304075c5c03e3a2f974535dc317904db2922 100644 --- a/src/TNL/Containers/MultiVector3D_impl.h +++ b/src/TNL/Containers/MultiVector3D_impl.h @@ -22,7 +22,7 @@ template< typename Real, typename Device, typename Index > String MultiVector< 3, Real, Device, Index > :: getType() { return String( "Containers::MultiVector< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Real >() ) + String( ", " ) + diff --git a/src/TNL/Containers/MultiVector4D_impl.h b/src/TNL/Containers/MultiVector4D_impl.h index ed69bd59d5075d918317ccad28f23e393f7efd18..3db8a363fc55efcdf618a68b3534393aceac0a79 100644 --- a/src/TNL/Containers/MultiVector4D_impl.h +++ b/src/TNL/Containers/MultiVector4D_impl.h @@ -22,7 +22,7 @@ template< typename Real, typename Device, typename Index > String MultiVector< 4, Real, Device, Index > :: getType() { return String( "Containers::MultiVector< ") + - String( Dimensions ) + + String( Dimension ) + String( ", " ) + String( TNL::getType< Real >() ) + String( ", " ) + diff --git a/src/TNL/Devices/Cuda.cu b/src/TNL/Devices/Cuda.cu index d2ac6e6b6dc9fc3854a7c48c5b9b2eec7da79897..0e59e2da5c75ede9f037a470bc16fdacaadcb855 100644 --- a/src/TNL/Devices/Cuda.cu +++ b/src/TNL/Devices/Cuda.cu @@ -15,6 +15,93 @@ namespace TNL { namespace Devices { + +void Cuda::setupThreads( const dim3& blockSize, + dim3& blocksCount, + dim3& gridsCount, + long long int xThreads, + long long int yThreads, + long long int zThreads ) +{ + blocksCount.x = max( 1, xThreads / blockSize.x + ( xThreads % blockSize.x != 0 ) ); + blocksCount.y = max( 1, yThreads / blockSize.y + ( yThreads % blockSize.y != 0 ) ); + blocksCount.z = max( 1, zThreads / blockSize.z + ( zThreads % blockSize.z != 0 ) ); + + /**** + * TODO: Fix the following: + * I do not known how to get max grid size in kernels :( + * + * Also, this is very slow. */ + /*int currentDevice( 0 ); + cudaGetDevice( currentDevice ); + cudaDeviceProp properties; + cudaGetDeviceProperties( &properties, currentDevice ); + gridsCount.x = blocksCount.x / properties.maxGridSize[ 0 ] + ( blocksCount.x % properties.maxGridSize[ 0 ] != 0 ); + gridsCount.y = blocksCount.y / properties.maxGridSize[ 1 ] + ( blocksCount.y % properties.maxGridSize[ 1 ] != 0 ); + gridsCount.z = blocksCount.z / properties.maxGridSize[ 2 ] + ( blocksCount.z % properties.maxGridSize[ 2 ] != 0 ); + */ + gridsCount.x = blocksCount.x / getMaxGridSize() + ( blocksCount.x % getMaxGridSize() != 0 ); + gridsCount.y = blocksCount.y / getMaxGridSize() + ( blocksCount.y % getMaxGridSize() != 0 ); + gridsCount.z = blocksCount.z / getMaxGridSize() + ( blocksCount.z % getMaxGridSize() != 0 ); +} + +void Cuda::setupGrid( const dim3& blocksCount, + const dim3& gridsCount, + const dim3& gridIdx, + dim3& gridSize ) +{ + /* TODO: this is extremely slow!!!! + int currentDevice( 0 ); + cudaGetDevice( ¤tDevice ); + cudaDeviceProp properties; + cudaGetDeviceProperties( &properties, currentDevice );*/ + + /**** + * TODO: fix the following + if( gridIdx.x < gridsCount.x ) + gridSize.x = properties.maxGridSize[ 0 ]; + else + gridSize.x = blocksCount.x % properties.maxGridSize[ 0 ]; + + if( gridIdx.y < gridsCount.y ) + gridSize.y = properties.maxGridSize[ 1 ]; + else + gridSize.y = blocksCount.y % properties.maxGridSize[ 1 ]; + + if( gridIdx.z < gridsCount.z ) + gridSize.z = properties.maxGridSize[ 2 ]; + else + gridSize.z = blocksCount.z % properties.maxGridSize[ 2 ];*/ + + if( gridIdx.x < gridsCount.x - 1 ) + gridSize.x = getMaxGridSize(); + else + gridSize.x = blocksCount.x % getMaxGridSize(); + + if( gridIdx.y < gridsCount.y - 1 ) + gridSize.y = getMaxGridSize(); + else + gridSize.y = blocksCount.y % getMaxGridSize(); + + if( gridIdx.z < gridsCount.z - 1 ) + gridSize.z = getMaxGridSize(); + else + gridSize.z = blocksCount.z % getMaxGridSize(); +} + +void Cuda::printThreadsSetup( const dim3& blockSize, + const dim3& blocksCount, + const dim3& gridSize, + const dim3& gridsCount, + std::ostream& str ) +{ + str << "Block size: " << blockSize << std::endl + << " Blocks count: " << blocksCount << std::endl + << " Grid size: " << gridSize << std::endl + << " Grids count: " << gridsCount << std::endl; +} + + bool Cuda::checkDevice( const char* file_name, int line, cudaError error ) { if( error == cudaSuccess ) @@ -397,5 +484,11 @@ bool Cuda::checkDevice( const char* file_name, int line, cudaError error ) return false; } +std::ostream& operator << ( std::ostream& str, const dim3& d ) +{ + str << "( " << d.x << ", " << d.y << ", " << d.z << " )"; + return str; +} + } // namespace Devices } // namespace TNL diff --git a/src/TNL/Devices/Cuda.h b/src/TNL/Devices/Cuda.h index 23f2f342eac8993b6e0099ce4678cab6bf64b5cb..6333b1ab5fb4f695815515cf742d370e0a454dca 100644 --- a/src/TNL/Devices/Cuda.h +++ b/src/TNL/Devices/Cuda.h @@ -49,16 +49,66 @@ class Cuda static inline constexpr int getGPUTransferBufferSize(); #ifdef HAVE_CUDA + /*** + * This function is obsolete and should be replaced by the following functions. + */ __device__ static inline int getGlobalThreadIdx( const int gridIdx = 0, - const int gridSize = getMaxGridSize() ); + const int gridSize = getMaxGridSize() ); + + __device__ static inline int + getGlobalThreadIdx_x( const dim3& gridIdx ); + + __device__ static inline int + getGlobalThreadIdx_y( const dim3& gridIdx ); + + __device__ static inline int + getGlobalThreadIdx_z( const dim3& gridIdx ); #endif + /**** + * This functions helps to count number of CUDA blocks depending on the + * number of the CUDA threads and the block size. + * It is obsolete and it will be replaced by setupThreads. + */ static int getNumberOfBlocks( const int threads, const int blockSize ); + /**** + * This functions helps to count number of CUDA grids depending on the + * number of the CUDA blocks and maximum grid size. + * It is obsolete and it will be replaced by setupThreads. + */ static int getNumberOfGrids( const int blocks, const int gridSize = getMaxGridSize() ); + +#ifdef HAVE_CUDA + /*! This method sets up gridSize and computes number of grids depending + * on total number of CUDA threads. + */ + static void setupThreads( const dim3& blockSize, + dim3& blocksCount, + dim3& gridsCount, + long long int xThreads, + long long int yThreads = 0, + long long int zThreads = 0 ); + + /*! This method sets up grid size when one iterates over more grids. + * If gridIdx.? < gridsCount.? then the gridSize.? is set to maximum + * allowed by CUDA. Otherwise gridSize.? is set to the size of the grid + * in the last loop i.e. blocksCount.? % maxGridSize.?. + */ + static void setupGrid( const dim3& blocksCount, + const dim3& gridsCount, + const dim3& gridIdx, + dim3& gridSize ); + + static void printThreadsSetup( const dim3& blockSize, + const dim3& blocksCount, + const dim3& gridSize, + const dim3& gridsCount, + std::ostream& str = std::cout ); +#endif template< typename ObjectType > static ObjectType* passToDevice( const ObjectType& object ); @@ -135,6 +185,7 @@ class Cuda #ifdef HAVE_CUDA #define checkCudaDevice ::TNL::Devices::Cuda::checkDevice( __FILE__, __LINE__, cudaGetLastError() ) +std::ostream& operator << ( std::ostream& str, const dim3& d ); #else #define checkCudaDevice ::TNL::Devices::Cuda::checkDevice() #endif diff --git a/src/TNL/Devices/Cuda_impl.h b/src/TNL/Devices/Cuda_impl.h index ad5198d7a767606d0acae453f864720838882ee5..cea827a03c3dbda07fb0f5b347bbb61ca6067bf1 100644 --- a/src/TNL/Devices/Cuda_impl.h +++ b/src/TNL/Devices/Cuda_impl.h @@ -53,6 +53,22 @@ __device__ inline int Cuda::getGlobalThreadIdx( const int gridIdx, const int gri { return ( gridIdx * gridSize + blockIdx.x ) * blockDim.x + threadIdx.x; } + +__device__ inline int Cuda::getGlobalThreadIdx_x( const dim3& gridIdx ) +{ + return ( gridIdx.x * getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x; +} + +__device__ inline int Cuda::getGlobalThreadIdx_y( const dim3& gridIdx ) +{ + return ( gridIdx.y * getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y; +} + +__device__ inline int Cuda::getGlobalThreadIdx_z( const dim3& gridIdx ) +{ + return ( gridIdx.z * getMaxGridSize() + blockIdx.z ) * blockDim.z + threadIdx.z; +} + #endif diff --git a/src/TNL/Functions/Analytic/Blob.h b/src/TNL/Functions/Analytic/Blob.h index 56c6e22b7eab001f03b45137b23ba6f2582d4798..6edcf2cf657401a72574f40a695977dc106b4a14 100644 --- a/src/TNL/Functions/Analytic/Blob.h +++ b/src/TNL/Functions/Analytic/Blob.h @@ -20,8 +20,8 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > -class BlobBase : public Domain< Dimensions, SpaceDomain > + int Dimension > +class BlobBase : public Domain< Dimension, SpaceDomain > { public: @@ -35,7 +35,7 @@ class BlobBase : public Domain< Dimensions, SpaceDomain > RealType height; }; -template< int Dimensions, +template< int Dimension, typename Real > class Blob { @@ -46,9 +46,9 @@ class Blob< 1, Real > : public BlobBase< Real, 1 > { public: - enum { Dimensions = 1 }; + enum { Dimension = 1 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -64,11 +64,11 @@ class Blob< 1, Real > : public BlobBase< Real, 1 > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -77,9 +77,9 @@ class Blob< 2, Real > : public BlobBase< Real, 2 > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -95,11 +95,11 @@ class Blob< 2, Real > : public BlobBase< Real, 2 > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -109,9 +109,9 @@ class Blob< 3, Real > : public BlobBase< Real, 3 > { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -127,17 +127,17 @@ class Blob< 3, Real > : public BlobBase< Real, 3 > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const Blob< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const Blob< Dimension, Real >& f ) { str << "Level-set pseudo square function."; return str; diff --git a/src/TNL/Functions/Analytic/Blob_impl.h b/src/TNL/Functions/Analytic/Blob_impl.h index c6d969d38527cfab69858a39f3d2fac3b340287e..b1787f365a8185e5b5c97872669c3ad040d6e3fb 100644 --- a/src/TNL/Functions/Analytic/Blob_impl.h +++ b/src/TNL/Functions/Analytic/Blob_impl.h @@ -17,9 +17,9 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > + int Dimension > bool -BlobBase< Real, Dimensions >:: +BlobBase< Real, Dimension >:: setup( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -51,7 +51,7 @@ template< typename Real > __cuda_callable__ Real Blob< 1, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -66,7 +66,7 @@ template< typename Real > __cuda_callable__ Real Blob< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -94,7 +94,7 @@ template< typename Real > __cuda_callable__ Real Blob< 2, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -110,7 +110,7 @@ template< typename Real > __cuda_callable__ Real Blob< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -138,7 +138,7 @@ template< typename Real > __cuda_callable__ Real Blob< 3, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -153,7 +153,7 @@ template< typename Real > __cuda_callable__ Real Blob< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Analytic/Constant.h b/src/TNL/Functions/Analytic/Constant.h index dc12be876f6adc50d423940d1c13c194adb26563..3ceba3cecd4a1009ea828f4f939d749afdc10208 100644 --- a/src/TNL/Functions/Analytic/Constant.h +++ b/src/TNL/Functions/Analytic/Constant.h @@ -25,7 +25,7 @@ class Constant : public Domain< dimensions, NonspaceDomain > public: typedef Real RealType; - typedef Containers::StaticVector< dimensions, RealType > VertexType; + typedef Containers::StaticVector< dimensions, RealType > PointType; Constant(); @@ -49,11 +49,11 @@ class Constant : public Domain< dimensions, NonspaceDomain > int ZDiffOrder = 0 > #endif __cuda_callable__ inline - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ inline - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const { return constant; diff --git a/src/TNL/Functions/Analytic/Constant_impl.h b/src/TNL/Functions/Analytic/Constant_impl.h index 5754a7017a1699c4bba2f45e3d422e02db8815fa..21311046be06cba4ce7f36ad4e8839d37482e459 100644 --- a/src/TNL/Functions/Analytic/Constant_impl.h +++ b/src/TNL/Functions/Analytic/Constant_impl.h @@ -14,46 +14,46 @@ namespace TNL { namespace Functions { namespace Analytic { -template< int Dimensions, +template< int Dimension, typename Real > -Constant< Dimensions, Real >:: +Constant< Dimension, Real >:: Constant() : constant( 0.0 ) { } -template< int Dimensions, +template< int Dimension, typename Real > void -Constant< Dimensions, Real >:: +Constant< Dimension, Real >:: setConstant( const RealType& constant ) { this->constant = constant; } -template< int Dimensions, +template< int Dimension, typename Real > const Real& -Constant< Dimensions, Real >:: +Constant< Dimension, Real >:: getConstant() const { return this->constant; } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real > void -Constant< FunctionDimensions, Real >:: +Constant< FunctionDimension, Real >:: configSetup( Config::ConfigDescription& config, const String& prefix ) { config.addEntry < double >( prefix + "constant", "Value of the constant function.", 0.0 ); } -template< int Dimensions, +template< int Dimension, typename Real > bool -Constant< Dimensions, Real >:: +Constant< Dimension, Real >:: setup( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -61,14 +61,14 @@ setup( const Config::ParameterContainer& parameters, return true; } -template< int Dimensions, +template< int Dimension, typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > Real -Constant< Dimensions, Real >:: -getPartialDerivative( const VertexType& v, +Constant< Dimension, Real >:: +getPartialDerivative( const PointType& v, const Real& time ) const { if( XDiffOrder || YDiffOrder || ZDiffOrder ) diff --git a/src/TNL/Functions/Analytic/Cylinder.h b/src/TNL/Functions/Analytic/Cylinder.h index bdfde9bd8d144bb187b333c638a653241be38c80..831b9fa18f1862949bb794318bc72eebb01f33c6 100644 --- a/src/TNL/Functions/Analytic/Cylinder.h +++ b/src/TNL/Functions/Analytic/Cylinder.h @@ -20,8 +20,8 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > -class CylinderBase : public Domain< Dimensions, SpaceDomain > + int Dimension > +class CylinderBase : public Domain< Dimension, SpaceDomain > { public: @@ -39,7 +39,7 @@ class CylinderBase : public Domain< Dimensions, SpaceDomain > RealType diameter; }; -template< int Dimensions, +template< int Dimension, typename Real > class Cylinder { @@ -50,9 +50,9 @@ class Cylinder< 1, Real > : public CylinderBase< Real, 1 > { public: - enum { Dimensions = 1 }; + enum { Dimension = 1 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -62,19 +62,19 @@ class Cylinder< 1, Real > : public CylinderBase< Real, 1 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -84,9 +84,9 @@ class Cylinder< 2, Real > : public CylinderBase< Real, 2 > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -96,19 +96,19 @@ class Cylinder< 2, Real > : public CylinderBase< Real, 2 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -118,9 +118,9 @@ class Cylinder< 3, Real > : public CylinderBase< Real, 3 > { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -130,26 +130,26 @@ class Cylinder< 3, Real > : public CylinderBase< Real, 3 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const Cylinder< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const Cylinder< Dimension, Real >& f ) { str << "Cylinder function."; return str; diff --git a/src/TNL/Functions/Analytic/Cylinder_impl.h b/src/TNL/Functions/Analytic/Cylinder_impl.h index 56a27935db2c7e3d198536babb64a4c1a956f4c4..b0698bca32056610195f5a9ab23c3e603455e1e5 100644 --- a/src/TNL/Functions/Analytic/Cylinder_impl.h +++ b/src/TNL/Functions/Analytic/Cylinder_impl.h @@ -17,9 +17,9 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > + int Dimension > bool -CylinderBase< Real, Dimensions >:: +CylinderBase< Real, Dimension >:: setup( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -28,17 +28,17 @@ setup( const Config::ParameterContainer& parameters, } template< typename Real, - int Dimensions > + int Dimension > void -CylinderBase< Real, Dimensions >:: +CylinderBase< Real, Dimension >:: setDiameter( const Real& sigma ) { this->diameter = diameter; } template< typename Real, - int Dimensions > -const Real& CylinderBase< Real, Dimensions >::getDiameter() const + int Dimension > +const Real& CylinderBase< Real, Dimension >::getDiameter() const { return this->diameter; } @@ -63,10 +63,10 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real -Cylinder< 1, Real >::getPartialDerivative( const Vertex& v, +Cylinder< 1, Real >::getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -81,7 +81,7 @@ template< typename Real > __cuda_callable__ Real Cylinder< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -107,11 +107,11 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real Cylinder< 2, Real >:: -getPartialDerivative( const Vertex& v, +getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -127,7 +127,7 @@ template< typename Real > __cuda_callable__ Real Cylinder< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -154,11 +154,11 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real Cylinder< 3, Real >:: -getPartialDerivative( const Vertex& v, +getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -173,7 +173,7 @@ template< typename Real > __cuda_callable__ Real Cylinder< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Analytic/ExpBump.h b/src/TNL/Functions/Analytic/ExpBump.h index 9b8e40a8220c8bf36de4fc0515b962183d3b1fa1..ce82270ccc70cc5b0044a7719ed4eec3d7234e3a 100644 --- a/src/TNL/Functions/Analytic/ExpBump.h +++ b/src/TNL/Functions/Analytic/ExpBump.h @@ -44,7 +44,7 @@ class ExpBumpBase : public Domain< dimensions, SpaceDomain > RealType amplitude, sigma; }; -template< int Dimensions, +template< int Dimension, typename Real > class ExpBump { @@ -56,7 +56,7 @@ class ExpBump< 1, Real > : public ExpBumpBase< 1, Real > public: typedef Real RealType; - typedef Containers::StaticVector< 1, RealType > VertexType; + typedef Containers::StaticVector< 1, RealType > PointType; static String getType(); @@ -72,11 +72,11 @@ class ExpBump< 1, Real > : public ExpBumpBase< 1, Real > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const RealType& time = 0.0 ) const; }; @@ -86,7 +86,7 @@ class ExpBump< 2, Real > : public ExpBumpBase< 2, Real > public: typedef Real RealType; - typedef Containers::StaticVector< 2, RealType > VertexType; + typedef Containers::StaticVector< 2, RealType > PointType; static String getType(); @@ -102,11 +102,11 @@ class ExpBump< 2, Real > : public ExpBumpBase< 2, Real > int ZDiffOrder = 0 > #endif __cuda_callable__ inline - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -116,7 +116,7 @@ class ExpBump< 3, Real > : public ExpBumpBase< 3, Real > public: typedef Real RealType; - typedef Containers::StaticVector< 3, RealType > VertexType; + typedef Containers::StaticVector< 3, RealType > PointType; static String getType(); @@ -133,18 +133,18 @@ class ExpBump< 3, Real > : public ExpBumpBase< 3, Real > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const ExpBump< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const ExpBump< Dimension, Real >& f ) { str << "ExpBump. function: amplitude = " << f.getAmplitude() << " sigma = " << f.getSigma(); return str; diff --git a/src/TNL/Functions/Analytic/ExpBump_impl.h b/src/TNL/Functions/Analytic/ExpBump_impl.h index 10e0c85528112934db051f51cf8d684e5d14707f..54ecbe2a66fb011e827c1c876aa385ad4b4eee57 100644 --- a/src/TNL/Functions/Analytic/ExpBump_impl.h +++ b/src/TNL/Functions/Analytic/ExpBump_impl.h @@ -82,7 +82,7 @@ template< typename Real > __cuda_callable__ Real ExpBump< 1, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { using namespace std; @@ -102,7 +102,7 @@ template< typename Real > __cuda_callable__ Real ExpBump< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -132,7 +132,7 @@ template< typename Real > __cuda_callable__ inline Real ExpBump< 2, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -158,7 +158,7 @@ template< typename Real > __cuda_callable__ Real ExpBump< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -187,7 +187,7 @@ template< typename Real > __cuda_callable__ Real ExpBump< 3, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -220,7 +220,7 @@ template< typename Real > __cuda_callable__ Real ExpBump< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Analytic/Flowerpot.h b/src/TNL/Functions/Analytic/Flowerpot.h index c8df009b7e42c7b955775c2b4486a423529d0252..2d33a4a9c989b8d0265576edbcc76ca4305418a8 100644 --- a/src/TNL/Functions/Analytic/Flowerpot.h +++ b/src/TNL/Functions/Analytic/Flowerpot.h @@ -20,8 +20,8 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > -class FlowerpotBase : public Domain< Dimensions, SpaceDomain > + int Dimension > +class FlowerpotBase : public Domain< Dimension, SpaceDomain > { public: @@ -39,7 +39,7 @@ class FlowerpotBase : public Domain< Dimensions, SpaceDomain > RealType diameter; }; -template< int Dimensions, +template< int Dimension, typename Real > class Flowerpot { @@ -50,9 +50,9 @@ class Flowerpot< 1, Real > : public FlowerpotBase< Real, 1 > { public: - enum { Dimensions = 1 }; + enum { Dimension = 1 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -62,19 +62,19 @@ class Flowerpot< 1, Real > : public FlowerpotBase< Real, 1 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -84,9 +84,9 @@ class Flowerpot< 2, Real > : public FlowerpotBase< Real, 2 > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -96,19 +96,19 @@ class Flowerpot< 2, Real > : public FlowerpotBase< Real, 2 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -118,9 +118,9 @@ class Flowerpot< 3, Real > : public FlowerpotBase< Real, 3 > { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -130,26 +130,26 @@ class Flowerpot< 3, Real > : public FlowerpotBase< Real, 3 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const Flowerpot< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const Flowerpot< Dimension, Real >& f ) { str << "Flowerpot function."; return str; diff --git a/src/TNL/Functions/Analytic/Flowerpot_impl.h b/src/TNL/Functions/Analytic/Flowerpot_impl.h index a3da8b4d2ae38d0972861cf49e77081240c1781c..455b4682b29780bdf526b45adf9b228c7c225073 100644 --- a/src/TNL/Functions/Analytic/Flowerpot_impl.h +++ b/src/TNL/Functions/Analytic/Flowerpot_impl.h @@ -17,9 +17,9 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > + int Dimension > bool -FlowerpotBase< Real, Dimensions >:: +FlowerpotBase< Real, Dimension >:: setup( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -28,15 +28,15 @@ setup( const Config::ParameterContainer& parameters, } template< typename Real, - int Dimensions > -void FlowerpotBase< Real, Dimensions >::setDiameter( const Real& sigma ) + int Dimension > +void FlowerpotBase< Real, Dimension >::setDiameter( const Real& sigma ) { this->diameter = diameter; } template< typename Real, - int Dimensions > -const Real& FlowerpotBase< Real, Dimensions >::getDiameter() const + int Dimension > +const Real& FlowerpotBase< Real, Dimension >::getDiameter() const { return this->diameter; } @@ -61,10 +61,10 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real -Flowerpot< 1, Real >::getPartialDerivative( const Vertex& v, +Flowerpot< 1, Real >::getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -79,7 +79,7 @@ template< typename Real > __cuda_callable__ Real Flowerpot< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -105,11 +105,11 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real Flowerpot< 2, Real >:: -getPartialDerivative( const Vertex& v, +getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -125,7 +125,7 @@ template< typename Real > __cuda_callable__ Real Flowerpot< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -152,11 +152,11 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real Flowerpot< 3, Real >:: -getPartialDerivative( const Vertex& v, +getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -171,7 +171,7 @@ template< typename Real > __cuda_callable__ Real Flowerpot< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Analytic/PseudoSquare.h b/src/TNL/Functions/Analytic/PseudoSquare.h index 26d3086f23b1fa855acec067dc0b72a5ba878e1e..2f9dadd8073e392e8bca816f77ca76f05f08aae7 100644 --- a/src/TNL/Functions/Analytic/PseudoSquare.h +++ b/src/TNL/Functions/Analytic/PseudoSquare.h @@ -20,8 +20,8 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > -class PseudoSquareBase : public Domain< Dimensions, SpaceDomain > + int Dimension > +class PseudoSquareBase : public Domain< Dimension, SpaceDomain > { public: @@ -35,7 +35,7 @@ class PseudoSquareBase : public Domain< Dimensions, SpaceDomain > RealType height; }; -template< int Dimensions, +template< int Dimension, typename Real > class PseudoSquare { @@ -46,9 +46,9 @@ class PseudoSquare< 1, Real > : public PseudoSquareBase< Real, 1 > { public: - enum { Dimensions = 1 }; + enum { Dimension = 1 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -64,11 +64,11 @@ class PseudoSquare< 1, Real > : public PseudoSquareBase< Real, 1 > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -77,9 +77,9 @@ class PseudoSquare< 2, Real > : public PseudoSquareBase< Real, 2 > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -95,11 +95,11 @@ class PseudoSquare< 2, Real > : public PseudoSquareBase< Real, 2 > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -108,9 +108,9 @@ class PseudoSquare< 3, Real > : public PseudoSquareBase< Real, 3 > { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -126,18 +126,18 @@ class PseudoSquare< 3, Real > : public PseudoSquareBase< Real, 3 > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const PseudoSquare< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const PseudoSquare< Dimension, Real >& f ) { str << "Level-set pseudo square function."; return str; diff --git a/src/TNL/Functions/Analytic/PseudoSquare_impl.h b/src/TNL/Functions/Analytic/PseudoSquare_impl.h index 378e11ac11c720b573a46d922b4d66cdb63ee66b..d2e1114f9a07a69a66ad44cf73e425e4db186f4c 100644 --- a/src/TNL/Functions/Analytic/PseudoSquare_impl.h +++ b/src/TNL/Functions/Analytic/PseudoSquare_impl.h @@ -17,9 +17,9 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > + int Dimension > bool -PseudoSquareBase< Real, Dimensions >:: +PseudoSquareBase< Real, Dimension >:: setup( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -52,7 +52,7 @@ template< typename Real > __cuda_callable__ Real PseudoSquare< 1, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -67,7 +67,7 @@ template< typename Real > __cuda_callable__ Real PseudoSquare< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -95,7 +95,7 @@ template< typename Real > __cuda_callable__ Real PseudoSquare< 2, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -111,7 +111,7 @@ template< typename Real > __cuda_callable__ Real PseudoSquare< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -139,7 +139,7 @@ template< typename Real > __cuda_callable__ Real PseudoSquare< 3, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -154,7 +154,7 @@ template< typename Real > __cuda_callable__ Real PseudoSquare< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Analytic/SinBumps.h b/src/TNL/Functions/Analytic/SinBumps.h index d3cc0434582e8b0c6df273f3063f382d1bef3ebb..fd3c104f26f059db31f9bed95b38bd36f81178e7 100644 --- a/src/TNL/Functions/Analytic/SinBumps.h +++ b/src/TNL/Functions/Analytic/SinBumps.h @@ -18,35 +18,35 @@ namespace TNL { namespace Functions { namespace Analytic { -template< typename Vertex > -class SinBumpsBase : public Domain< Vertex::size, SpaceDomain > +template< typename Point > +class SinBumpsBase : public Domain< Point::size, SpaceDomain > { public: - typedef Vertex VertexType; - typedef typename Vertex::RealType RealType; - enum { Dimensions = VertexType::size }; + typedef Point PointType; + typedef typename Point::RealType RealType; + enum { Dimension = PointType::size }; - void setWaveLength( const VertexType& waveLength ); + void setWaveLength( const PointType& waveLength ); - const VertexType& getWaveLength() const; + const PointType& getWaveLength() const; void setAmplitude( const RealType& amplitude ); const RealType& getAmplitude() const; - void setPhase( const VertexType& phase ); + void setPhase( const PointType& phase ); - const VertexType& getPhase() const; + const PointType& getPhase() const; protected: RealType amplitude; - VertexType waveLength, phase; + PointType waveLength, phase; }; -template< int Dimensions, typename Real > +template< int Dimension, typename Real > class SinBumps { }; @@ -57,7 +57,7 @@ class SinBumps< 1, Real > : public SinBumpsBase< Containers::StaticVector< 1, R public: typedef Real RealType; - typedef Containers::StaticVector< 1, RealType > VertexType; + typedef Containers::StaticVector< 1, RealType > PointType; SinBumps(); @@ -75,11 +75,11 @@ class SinBumps< 1, Real > : public SinBumpsBase< Containers::StaticVector< 1, R int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -90,7 +90,7 @@ class SinBumps< 2, Real > : public SinBumpsBase< Containers::StaticVector< 2, Re public: typedef Real RealType; - typedef Containers::StaticVector< 2, RealType > VertexType; + typedef Containers::StaticVector< 2, RealType > PointType; SinBumps(); @@ -108,11 +108,11 @@ class SinBumps< 2, Real > : public SinBumpsBase< Containers::StaticVector< 2, Re int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -123,7 +123,7 @@ class SinBumps< 3, Real > : public SinBumpsBase< Containers::StaticVector< 3, Re public: typedef Real RealType; - typedef Containers::StaticVector< 3, RealType > VertexType; + typedef Containers::StaticVector< 3, RealType > PointType; SinBumps(); @@ -140,18 +140,18 @@ class SinBumps< 3, Real > : public SinBumpsBase< Containers::StaticVector< 3, Re int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const SinBumps< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const SinBumps< Dimension, Real >& f ) { str << "Sin Bumps. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength() diff --git a/src/TNL/Functions/Analytic/SinBumps_impl.h b/src/TNL/Functions/Analytic/SinBumps_impl.h index 8ae3eeb6abdce64ee0db3df89c5e59ada351f58b..7e0f5da66ba4956f9638ff5eb075414e0cc3850d 100644 --- a/src/TNL/Functions/Analytic/SinBumps_impl.h +++ b/src/TNL/Functions/Analytic/SinBumps_impl.h @@ -16,38 +16,38 @@ namespace TNL { namespace Functions { namespace Analytic { -template< typename Vertex > -void SinBumpsBase< Vertex >::setWaveLength( const Vertex& waveLength ) +template< typename Point > +void SinBumpsBase< Point >::setWaveLength( const Point& waveLength ) { this->waveLength = waveLength; } -template< typename Vertex > -const Vertex& SinBumpsBase< Vertex >::getWaveLength() const +template< typename Point > +const Point& SinBumpsBase< Point >::getWaveLength() const { return this->waveLength; } -template< typename Vertex > -void SinBumpsBase< Vertex >::setAmplitude( const typename Vertex::RealType& amplitude ) +template< typename Point > +void SinBumpsBase< Point >::setAmplitude( const typename Point::RealType& amplitude ) { this->amplitude = amplitude; } -template< typename Vertex > -const typename Vertex::RealType& SinBumpsBase< Vertex >::getAmplitude() const +template< typename Point > +const typename Point::RealType& SinBumpsBase< Point >::getAmplitude() const { return this->amplitude; } -template< typename Vertex > -void SinBumpsBase< Vertex >::setPhase( const Vertex& phase ) +template< typename Point > +void SinBumpsBase< Point >::setPhase( const Point& phase ) { this->phase = phase; } -template< typename Vertex > -const Vertex& SinBumpsBase< Vertex >::getPhase() const +template< typename Point > +const Point& SinBumpsBase< Point >::getPhase() const { return this->phase; } @@ -79,7 +79,7 @@ template< typename Real > __cuda_callable__ Real SinBumps< 1, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -98,7 +98,7 @@ template< typename Real > __cuda_callable__ Real SinBumps< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -134,7 +134,7 @@ template< typename Real > __cuda_callable__ Real SinBumps< 2, Real>:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -162,7 +162,7 @@ template< typename Real > __cuda_callable__ Real SinBumps< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -199,7 +199,7 @@ template< typename Real > __cuda_callable__ Real SinBumps< 3, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -235,7 +235,7 @@ template< typename Real > __cuda_callable__ Real SinBumps< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Analytic/SinWave.h b/src/TNL/Functions/Analytic/SinWave.h index 98c8cdddc6e8f9d0a0433fca653ade91d5d85665..bf4678c13c0f08686e43654783f3bb139e77ba1f 100644 --- a/src/TNL/Functions/Analytic/SinWave.h +++ b/src/TNL/Functions/Analytic/SinWave.h @@ -46,7 +46,7 @@ class SinWaveBase : public Domain< dimensions, SpaceDomain > Real waveLength, amplitude, phase, wavesNumber; }; -template< int Dimensions, typename Real > +template< int Dimension, typename Real > class SinWave { }; @@ -57,7 +57,7 @@ class SinWave< 1, Real > : public SinWaveBase< 1, Real > public: typedef Real RealType; - typedef Containers::StaticVector< 1, RealType > VertexType; + typedef Containers::StaticVector< 1, RealType > PointType; #ifdef HAVE_NOT_CXX11 template< int XDiffOrder, @@ -69,11 +69,11 @@ class SinWave< 1, Real > : public SinWaveBase< 1, Real > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -84,7 +84,7 @@ class SinWave< 2, Real > : public SinWaveBase< 2, Real > public: typedef Real RealType; - typedef Containers::StaticVector< 2, RealType > VertexType; + typedef Containers::StaticVector< 2, RealType > PointType; #ifdef HAVE_NOT_CXX11 template< int XDiffOrder, @@ -96,11 +96,11 @@ class SinWave< 2, Real > : public SinWaveBase< 2, Real > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -111,7 +111,7 @@ class SinWave< 3, Real > : public SinWaveBase< 3, Real > public: typedef Real RealType; - typedef Containers::StaticVector< 3, RealType > VertexType; + typedef Containers::StaticVector< 3, RealType > PointType; @@ -125,18 +125,18 @@ class SinWave< 3, Real > : public SinWaveBase< 3, Real > int ZDiffOrder = 0 > #endif __cuda_callable__ - RealType getPartialDerivative( const VertexType& v, + RealType getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const SinWave< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const SinWave< Dimension, Real >& f ) { str << "Sin Wave. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength() diff --git a/src/TNL/Functions/Analytic/SinWave_impl.h b/src/TNL/Functions/Analytic/SinWave_impl.h index 56d3bd251203bde26d330daf7d06160551f4d94a..eea5f461561830037c96f1ac8ab327915a19fa33 100644 --- a/src/TNL/Functions/Analytic/SinWave_impl.h +++ b/src/TNL/Functions/Analytic/SinWave_impl.h @@ -81,7 +81,7 @@ template< typename Real > __cuda_callable__ Real SinWave< 1, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -109,7 +109,7 @@ template< typename Real > __cuda_callable__ Real SinWave< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -124,7 +124,7 @@ template< typename Real > __cuda_callable__ Real SinWave< 2, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -153,7 +153,7 @@ template< typename Real > __cuda_callable__ Real SinWave< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -167,7 +167,7 @@ template< typename Real > __cuda_callable__ Real SinWave< 3, Real >:: -getPartialDerivative( const VertexType& v, +getPartialDerivative( const PointType& v, const Real& time ) const { const RealType& x = v.x(); @@ -205,7 +205,7 @@ template< typename Real > __cuda_callable__ Real SinWave< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Analytic/Twins.h b/src/TNL/Functions/Analytic/Twins.h index ebdb507ac79e84681396715254ff4d4e30ff1b9e..bd4aecc79231c7a81b144a6ddcf04ca8b81ec837 100644 --- a/src/TNL/Functions/Analytic/Twins.h +++ b/src/TNL/Functions/Analytic/Twins.h @@ -20,8 +20,8 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > -class TwinsBase : public Domain< Dimensions, SpaceDomain > + int Dimension > +class TwinsBase : public Domain< Dimension, SpaceDomain > { public: @@ -31,7 +31,7 @@ class TwinsBase : public Domain< Dimensions, SpaceDomain > const String& prefix = "" ); }; -template< int Dimensions, +template< int Dimension, typename Real > class Twins { @@ -42,9 +42,9 @@ class Twins< 1, Real > : public TwinsBase< Real, 1 > { public: - enum { Dimensions = 1 }; + enum { Dimension = 1 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -54,19 +54,19 @@ class Twins< 1, Real > : public TwinsBase< Real, 1 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -76,9 +76,9 @@ class Twins< 2, Real > : public TwinsBase< Real, 2 > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -88,19 +88,19 @@ class Twins< 2, Real > : public TwinsBase< Real, 2 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; @@ -110,9 +110,9 @@ class Twins< 3, Real > : public TwinsBase< Real, 3 > { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; static String getType(); @@ -122,26 +122,26 @@ class Twins< 3, Real > : public TwinsBase< Real, 3 > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > #else template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, - typename Vertex = VertexType > + typename Point = PointType > #endif __cuda_callable__ - RealType getPartialDerivative( const Vertex& v, + RealType getPartialDerivative( const Point& v, const Real& time = 0.0 ) const; __cuda_callable__ - RealType operator()( const VertexType& v, + RealType operator()( const PointType& v, const Real& time = 0.0 ) const; }; -template< int Dimensions, +template< int Dimension, typename Real > -std::ostream& operator << ( std::ostream& str, const Twins< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const Twins< Dimension, Real >& f ) { str << "Twins function."; return str; diff --git a/src/TNL/Functions/Analytic/Twins_impl.h b/src/TNL/Functions/Analytic/Twins_impl.h index 222f9a452adf289bcc9282c75cf2014ecc23c289..aa7d4d1f972eb89c838c9445428590e996df2347 100644 --- a/src/TNL/Functions/Analytic/Twins_impl.h +++ b/src/TNL/Functions/Analytic/Twins_impl.h @@ -17,9 +17,9 @@ namespace Functions { namespace Analytic { template< typename Real, - int Dimensions > + int Dimension > bool -TwinsBase< Real, Dimensions >:: +TwinsBase< Real, Dimension >:: setup( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -47,10 +47,10 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real -Twins< 1, Real >::getPartialDerivative( const Vertex& v, +Twins< 1, Real >::getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -65,7 +65,7 @@ template< typename Real > __cuda_callable__ Real Twins< 1, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -91,11 +91,11 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real Twins< 2, Real >:: -getPartialDerivative( const Vertex& v, +getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -111,7 +111,7 @@ template< typename Real > __cuda_callable__ Real Twins< 2, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); @@ -137,11 +137,11 @@ template< typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, - typename Vertex > + typename Point > __cuda_callable__ Real Twins< 3, Real >:: -getPartialDerivative( const Vertex& v, +getPartialDerivative( const Point& v, const Real& time ) const { const RealType& x = v.x(); @@ -156,7 +156,7 @@ template< typename Real > __cuda_callable__ Real Twins< 3, Real >:: -operator()( const VertexType& v, +operator()( const PointType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); diff --git a/src/TNL/Functions/Domain.h b/src/TNL/Functions/Domain.h index ffef9577dbfabdd1c0338e681b6ef128c23a7f82..07a8c878c214c0baeb4e2677cd2f92cab161ddee 100644 --- a/src/TNL/Functions/Domain.h +++ b/src/TNL/Functions/Domain.h @@ -16,7 +16,7 @@ namespace Functions { enum DomainType { NonspaceDomain, SpaceDomain, MeshDomain, MeshInteriorDomain, MeshBoundaryDomain }; -template< int Dimensions, +template< int Dimension, DomainType DomainType_ = SpaceDomain > class Domain { @@ -24,7 +24,7 @@ class Domain typedef void DeviceType; - static constexpr int getDomainDimensions() { return Dimensions; } + static constexpr int getDomainDimension() { return Dimension; } static constexpr DomainType getDomainType() { return DomainType_; } }; diff --git a/src/TNL/Functions/ExactOperatorFunction.h b/src/TNL/Functions/ExactOperatorFunction.h index 02d9d797287ab9fffe7e14ca138d48368560669c..7561e693b71687bb5f6eaf368c9756e9fcf1499e 100644 --- a/src/TNL/Functions/ExactOperatorFunction.h +++ b/src/TNL/Functions/ExactOperatorFunction.h @@ -17,9 +17,9 @@ namespace Functions { template< typename Operator, typename Function > -class ExactOperatorFunction : public Domain< Operator::getDomainDimensions(), SpaceDomain > +class ExactOperatorFunction : public Domain< Operator::getDomainDimension(), SpaceDomain > { - static_assert( Operator::getDomainDimensions() == Function::getDomainDimensions(), + static_assert( Operator::getDomainDimension() == Function::getDomainDimension(), "Operator and function have different number of domain dimensions." ); public: @@ -27,9 +27,9 @@ class ExactOperatorFunction : public Domain< Operator::getDomainDimensions(), Sp typedef Operator OperatorType; typedef Function FunctionType; typedef typename FunctionType::RealType RealType; - typedef typename FunctionType::VertexType VertexType; + typedef typename FunctionType::PointType PointType; - static constexpr int getDomainDimensions() { return Operator::getDomainDimensions(); } + static constexpr int getDomainDimension() { return Operator::getDomainDimension(); } ExactOperatorFunction( const OperatorType& operator_, @@ -38,7 +38,7 @@ class ExactOperatorFunction : public Domain< Operator::getDomainDimensions(), Sp __cuda_callable__ RealType operator()( - const VertexType& vertex, + const PointType& vertex, const RealType& time ) const { return this->operator_( function, vertex, time ); diff --git a/src/TNL/Functions/FunctionAdapter.h b/src/TNL/Functions/FunctionAdapter.h index 27b46d93cae78d1e5df5b7164fe59c601850c8ee..2128ce811d135c28262b8b8b0c684d7016cfcaba 100644 --- a/src/TNL/Functions/FunctionAdapter.h +++ b/src/TNL/Functions/FunctionAdapter.h @@ -30,7 +30,7 @@ class FunctionAdapter typedef Mesh MeshType; typedef typename FunctionType::RealType RealType; typedef typename MeshType::IndexType IndexType; - //typedef typename FunctionType::VertexType VertexType; + //typedef typename FunctionType::PointType PointType; template< typename MeshPointer > static bool setup( FunctionType& function, @@ -65,7 +65,7 @@ class FunctionAdapter< Mesh, Function, SpaceDomain > typedef Mesh MeshType; typedef typename FunctionType::RealType RealType; typedef typename MeshType::IndexType IndexType; - typedef typename FunctionType::VertexType VertexType; + typedef typename FunctionType::PointType PointType; template< typename MeshPointer > static bool setup( FunctionType& function, @@ -102,7 +102,7 @@ class FunctionAdapter< Mesh, Function, NonspaceDomain > typedef Mesh MeshType; typedef typename FunctionType::RealType RealType; typedef typename MeshType::IndexType IndexType; - typedef typename FunctionType::VertexType VertexType; + typedef typename FunctionType::PointType PointType; template< typename MeshPointer > static bool setup( FunctionType& function, @@ -162,7 +162,7 @@ class FunctionAdapter< Mesh, Function, SpaceDomain > typedef Mesh MeshType; typedef typename FunctionType::RealType RealType; typedef typename MeshType::IndexType IndexType; - typedef typename FunctionType::VertexType VertexType; + typedef typename FunctionType::PointType PointType; template< typename EntityType > __cuda_callable__ inline @@ -187,7 +187,7 @@ class FunctionAdapter< Mesh, Function, SpaceDomain > typedef Mesh MeshType; typedef typename FunctionType::RealType RealType; typedef typename MeshType::IndexType IndexType; - typedef typename FunctionType::VertexType VertexType; + typedef typename FunctionType::PointType PointType; template< typename EntityType > __cuda_callable__ inline diff --git a/src/TNL/Functions/MeshFunction.h b/src/TNL/Functions/MeshFunction.h index a3cf8a46c307312ff0e10127da53339c48ddb3e4..bedefc2169f02f19bce9434080366d9e90f66a75 100644 --- a/src/TNL/Functions/MeshFunction.h +++ b/src/TNL/Functions/MeshFunction.h @@ -20,11 +20,11 @@ namespace TNL { namespace Functions { template< typename Mesh, - int MeshEntityDimensions = Mesh::meshDimensions, + int MeshEntityDimension = Mesh::meshDimension, typename Real = typename Mesh::RealType > class MeshFunction : public Object, - public Domain< Mesh::meshDimensions, MeshDomain > + public Domain< Mesh::meshDimension, MeshDomain > { //static_assert( Mesh::DeviceType::DeviceType == Vector::DeviceType::DeviceType, // "Both mesh and vector of a mesh function must reside on the same device."); @@ -36,9 +36,11 @@ class MeshFunction : typedef SharedPointer< MeshType > MeshPointer; typedef Real RealType; typedef Containers::Vector< RealType, DeviceType, IndexType > VectorType; - typedef Functions::MeshFunction< Mesh, MeshEntityDimensions, Real > ThisType; + typedef Functions::MeshFunction< Mesh, MeshEntityDimension, Real > ThisType; - static constexpr int getEntitiesDimensions() { return MeshEntityDimensions; } + static constexpr int getEntitiesDimension() { return MeshEntityDimension; } + + static constexpr int getMeshDimensions() { return MeshType::getMeshDimension(); } MeshFunction(); diff --git a/src/TNL/Functions/MeshFunctionEvaluator.h b/src/TNL/Functions/MeshFunctionEvaluator.h index 982ed8b9a150d0d33a6211c5d01c87cb8290798b..ad08b901404b1110c81943ffd753984e9ebe9aaa 100644 --- a/src/TNL/Functions/MeshFunctionEvaluator.h +++ b/src/TNL/Functions/MeshFunctionEvaluator.h @@ -58,7 +58,7 @@ template< typename OutMeshFunction, typename InFunction > class MeshFunctionEvaluator { - static_assert( OutMeshFunction::getDomainDimensions() == InFunction::getDomainDimensions(), + static_assert( OutMeshFunction::getDomainDimension() == InFunction::getDomainDimension(), "Input and output functions must have the same domain dimensions." ); public: diff --git a/src/TNL/Functions/MeshFunctionEvaluator_impl.h b/src/TNL/Functions/MeshFunctionEvaluator_impl.h index 205cc979ac9fdabc191fb479443ddb2c9dc8bea7..408e0882fc1e354ae87d89e1859fc61150fd0049 100644 --- a/src/TNL/Functions/MeshFunctionEvaluator_impl.h +++ b/src/TNL/Functions/MeshFunctionEvaluator_impl.h @@ -115,7 +115,7 @@ evaluateEntities( OutMeshFunctionPointer& meshFunction, static_assert( std::is_same< typename std::decay< typename OutMeshFunctionPointer::ObjectType >::type, OutMeshFunction >::value, "expected a smart pointer" ); static_assert( std::is_same< typename std::decay< typename InFunctionPointer::ObjectType >::type, InFunction >::value, "expected a smart pointer" ); - typedef typename MeshType::template MeshEntity< OutMeshFunction::getEntitiesDimensions() > MeshEntityType; + typedef typename MeshType::template MeshEntity< OutMeshFunction::getEntitiesDimension() > MeshEntityType; typedef Functions::MeshFunctionEvaluatorAssignmentEntitiesProcessor< MeshType, TraverserUserData > AssignmentEntitiesProcessor; typedef Functions::MeshFunctionEvaluatorAdditionEntitiesProcessor< MeshType, TraverserUserData > AdditionEntitiesProcessor; //typedef typename OutMeshFunction::MeshPointer OutMeshPointer; diff --git a/src/TNL/Functions/MeshFunctionGnuplotWriter_impl.h b/src/TNL/Functions/MeshFunctionGnuplotWriter_impl.h index 341ed711a4cb4da60f3f6501a5dec0f8b736925a..7a5a3900251950d38cc76052e976b697d7dd0c6e 100644 --- a/src/TNL/Functions/MeshFunctionGnuplotWriter_impl.h +++ b/src/TNL/Functions/MeshFunctionGnuplotWriter_impl.h @@ -44,7 +44,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -70,7 +70,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -101,7 +101,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -137,7 +137,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -156,7 +156,7 @@ write( const MeshFunctionType& function, { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -189,7 +189,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -225,7 +225,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << v.z() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -264,7 +264,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << v.z() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -284,7 +284,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().y() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << v.z() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -304,7 +304,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().z() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << v.z() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } @@ -340,7 +340,7 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() ++ ) { entity.refresh(); - typename MeshType::VertexType v = entity.getCenter(); + typename MeshType::PointType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << v.z() << " " << function.getData().getElement( entity.getIndex() ) << std::endl; } diff --git a/src/TNL/Functions/MeshFunctionNormGetter.h b/src/TNL/Functions/MeshFunctionNormGetter.h index 8f09c90e3f5b36b63de4e26f71f5993c1819432a..6f7e127c173b0dc0b67f51f800ced2f9d333cc6a 100644 --- a/src/TNL/Functions/MeshFunctionNormGetter.h +++ b/src/TNL/Functions/MeshFunctionNormGetter.h @@ -23,18 +23,18 @@ class MeshFunctionNormGetter * Specialization for grids * TODO: implement this even for other devices */ -template< int Dimensions, +template< int Dimension, typename MeshReal, typename MeshIndex, - int EntityDimensions, + int EntityDimension, typename Real > -class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimensions, MeshReal, Devices::Host, MeshIndex >, EntityDimensions, Real >, - Meshes::Grid< Dimensions, MeshReal, Devices::Host, MeshIndex > > +class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Host, MeshIndex >, EntityDimension, Real >, + Meshes::Grid< Dimension, MeshReal, Devices::Host, MeshIndex > > { public: - typedef Functions::MeshFunction< Meshes::Grid< Dimensions, MeshReal, Devices::Host, MeshIndex >, EntityDimensions, Real > MeshFunctionType; - typedef Meshes::Grid< Dimensions, MeshReal, Devices::Host, MeshIndex > GridType; + typedef Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Host, MeshIndex >, EntityDimension, Real > MeshFunctionType; + typedef Meshes::Grid< Dimension, MeshReal, Devices::Host, MeshIndex > GridType; typedef MeshReal MeshRealType; typedef Devices::Host DeviceType; typedef MeshIndex MeshIndexType; @@ -45,7 +45,7 @@ class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimensions, MeshReal, static RealType getNorm( const MeshFunctionType& function, const RealType& p ) { - if( EntityDimensions == Dimensions ) + if( EntityDimension == Dimension ) { if( p == 1.0 ) return function.getMesh().getCellMeasure() * function.getData().lpNorm( 1.0 ); @@ -53,7 +53,7 @@ class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimensions, MeshReal, return std::sqrt( function.getMesh().getCellMeasure() ) * function.getData().lpNorm( 2.0 ); return std::pow( function.getMesh().getCellMeasure(), 1.0 / p ) * function.getData().lpNorm( p ); } - if( EntityDimensions > 0 ) + if( EntityDimension > 0 ) { if( p == 1.0 ) { @@ -102,18 +102,18 @@ class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimensions, MeshReal, /**** * Specialization for CUDA devices */ -template< int Dimensions, +template< int Dimension, typename MeshReal, typename MeshIndex, - int EntityDimensions, + int EntityDimension, typename Real > -class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimensions, MeshReal, Devices::Cuda, MeshIndex >, EntityDimensions, Real >, - Meshes::Grid< Dimensions, MeshReal, Devices::Cuda, MeshIndex > > +class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Cuda, MeshIndex >, EntityDimension, Real >, + Meshes::Grid< Dimension, MeshReal, Devices::Cuda, MeshIndex > > { public: - typedef Functions::MeshFunction< Meshes::Grid< Dimensions, MeshReal, Devices::Cuda, MeshIndex >, EntityDimensions, Real > MeshFunctionType; - typedef Meshes::Grid< Dimensions, MeshReal, Devices::Cuda, MeshIndex > GridType; + typedef Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Cuda, MeshIndex >, EntityDimension, Real > MeshFunctionType; + typedef Meshes::Grid< Dimension, MeshReal, Devices::Cuda, MeshIndex > GridType; typedef MeshReal MeshRealType; typedef Devices::Cuda DeviceType; typedef MeshIndex MeshIndexType; @@ -124,7 +124,7 @@ class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimensions, MeshReal, static RealType getNorm( const MeshFunctionType& function, const RealType& p ) { - if( EntityDimensions == Dimensions ) + if( EntityDimension == Dimension ) { if( p == 1.0 ) return function.getMesh().getCellMeasure() * function.getData().lpNorm( 1.0 ); @@ -132,7 +132,7 @@ class MeshFunctionNormGetter< MeshFunction< Meshes::Grid< Dimensions, MeshReal, return ::sqrt( function.getMesh().getCellMeasure() ) * function.getData().lpNorm( 2.0 ); return ::pow( function.getMesh().getCellMeasure(), 1.0 / p ) * function.getData().lpNorm( p ); } - if( EntityDimensions > 0 ) + if( EntityDimension > 0 ) { TNL_ASSERT( false, std::cerr << "Not implemented yet." << std::endl ); } diff --git a/src/TNL/Functions/MeshFunctionVTKWriter_impl.h b/src/TNL/Functions/MeshFunctionVTKWriter_impl.h index b432671764c0545c64e5c8ea241c820525f20f05..d48dd535cb2b09d83cc7c8c04e9e3adaf8801f11 100644 --- a/src/TNL/Functions/MeshFunctionVTKWriter_impl.h +++ b/src/TNL/Functions/MeshFunctionVTKWriter_impl.h @@ -39,8 +39,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -108,8 +108,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -177,8 +177,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -257,8 +257,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -346,8 +346,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -425,8 +425,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -521,8 +521,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -640,8 +640,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; @@ -753,8 +753,8 @@ writeHeader( const MeshFunctionType& function, std::ostream& str ) { const MeshType& mesh = function.getMesh(); - const typename MeshType::VertexType& origin = mesh.getOrigin(); - const typename MeshType::VertexType& proportions = mesh.getProportions(); + const typename MeshType::PointType& origin = mesh.getOrigin(); + const typename MeshType::PointType& proportions = mesh.getProportions(); str << "# vtk DataFile Version 2.0" << std::endl; str << "TNL DATA" << std::endl; str << "ASCII" << std::endl; diff --git a/src/TNL/Functions/MeshFunction_impl.h b/src/TNL/Functions/MeshFunction_impl.h index 53ab95680738b8ee77c7a76ca7de9e7344f3f3a8..657d917a7b7968d4f4610ffd0b062b9d52c6855e 100644 --- a/src/TNL/Functions/MeshFunction_impl.h +++ b/src/TNL/Functions/MeshFunction_impl.h @@ -22,30 +22,30 @@ namespace TNL { namespace Functions { template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: MeshFunction() { } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: MeshFunction( const MeshPointer& meshPointer ) : meshPointer( meshPointer ) { - this->data.setSize( meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimensions > >() ); - TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(), + this->data.setSize( meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimension > >() ); + TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(), std::cerr << "this->data.getSize() = " << this->data.getSize() << std::endl - << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() = " << this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() ); + << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() = " << this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: MeshFunction( const ThisType& meshFunction ) : meshPointer( meshFunction.meshPointer ) { @@ -53,91 +53,91 @@ MeshFunction( const ThisType& meshFunction ) } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Vector > -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: MeshFunction( const MeshPointer& meshPointer, Vector& data, const IndexType& offset ) : meshPointer( meshPointer ) { - this->data.bind( data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimensions > >() ); - TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(), + this->data.bind( data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimension > >() ); + TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(), std::cerr << "this->data.getSize() = " << this->data.getSize() << std::endl - << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() ); + << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Vector > -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: MeshFunction( const MeshPointer& meshPointer, SharedPointer< Vector >& data, const IndexType& offset ) : meshPointer( meshPointer ) { - this->data.bind( *data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimensions > >() ); - TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(), + this->data.bind( *data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimension > >() ); + TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(), std::cerr << "this->data.getSize() = " << this->data.getSize() << std::endl - << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() ); + << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > String -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: getType() { return String( "Functions::MeshFunction< " ) + Mesh::getType() + ", " + - String( MeshEntityDimensions ) + ", " + + String( MeshEntityDimension ) + ", " + TNL::getType< Real >() + " >"; }; template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > String -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: getTypeVirtual() const { return this->getType(); }; template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > String -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: getSerializationType() { return String( "Functions::MeshFunction< " ) + Mesh::getSerializationType() + ", " + - String( MeshEntityDimensions ) + ", " + + String( MeshEntityDimension ) + ", " + TNL::getType< Real >() + " >"; }; template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > String -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: getSerializationTypeVirtual() const { return this->getSerializationType(); }; template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > void -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: configSetup( Config::ConfigDescription& config, const String& prefix ) { @@ -145,10 +145,10 @@ configSetup( Config::ConfigDescription& config, } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > bool -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix ) @@ -169,10 +169,10 @@ setup( const MeshPointer& meshPointer, } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > void -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: bind( ThisType& meshFunction ) { this->meshPointer = meshFunction.getMeshPointer(); @@ -180,199 +180,199 @@ bind( ThisType& meshFunction ) } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Vector > void -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: bind( const MeshPointer& meshPointer, const Vector& data, const IndexType& offset ) { this->meshPointer = meshPointer; - this->data.bind( data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimensions > >() ); - TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(), + this->data.bind( data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimension > >() ); + TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(), std::cerr << "this->data.getSize() = " << this->data.getSize() << std::endl - << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() ); + << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Vector > void -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: bind( const MeshPointer& meshPointer, const SharedPointer< Vector >& data, const IndexType& offset ) { this->meshPointer = meshPointer; - this->data.bind( *data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimensions > >() ); - TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(), + this->data.bind( *data, offset, meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimension > >() ); + TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(), std::cerr << "this->data.getSize() = " << this->data.getSize() << std::endl - << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() ); + << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() = " << this->meshPointer->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > void -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: setMesh( const MeshPointer& meshPointer ) { this->meshPointer = meshPointer; - this->data.setSize( meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimensions > >() ); - TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(), + this->data.setSize( meshPointer->template getEntitiesCount< typename Mesh::template MeshEntity< MeshEntityDimension > >() ); + TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(), std::cerr << "this->data.getSize() = " << this->data.getSize() << std::endl - << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() = " << this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() ); + << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() = " << this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Device > __cuda_callable__ -const typename MeshFunction< Mesh, MeshEntityDimensions, Real >::MeshType& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +const typename MeshFunction< Mesh, MeshEntityDimension, Real >::MeshType& +MeshFunction< Mesh, MeshEntityDimension, Real >:: getMesh() const { return this->meshPointer.template getData< Device >(); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > -const typename MeshFunction< Mesh, MeshEntityDimensions, Real >::MeshPointer& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +const typename MeshFunction< Mesh, MeshEntityDimension, Real >::MeshPointer& +MeshFunction< Mesh, MeshEntityDimension, Real >:: getMeshPointer() const { return this->meshPointer; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > __cuda_callable__ -const typename MeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +const typename MeshFunction< Mesh, MeshEntityDimension, Real >::VectorType& +MeshFunction< Mesh, MeshEntityDimension, Real >:: getData() const { return this->data; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > __cuda_callable__ -typename MeshFunction< Mesh, MeshEntityDimensions, Real >::VectorType& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +typename MeshFunction< Mesh, MeshEntityDimension, Real >::VectorType& +MeshFunction< Mesh, MeshEntityDimension, Real >:: getData() { return this->data; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > bool -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: refresh( const RealType& time ) const { return true; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > bool -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: deepRefresh( const RealType& time ) const { return true; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename EntityType > -typename Functions::MeshFunction< Mesh, MeshEntityDimensions, Real >::RealType -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType +MeshFunction< Mesh, MeshEntityDimension, Real >:: getValue( const EntityType& meshEntity ) const { - static_assert( EntityType::entityDimensions == MeshEntityDimensions, "Calling with wrong EntityType -- entity dimensions do not match." ); + static_assert( EntityType::entityDimension == MeshEntityDimension, "Calling with wrong EntityType -- entity dimension do not match." ); return this->data.getValue( meshEntity.getIndex() ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename EntityType > void -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: setValue( const EntityType& meshEntity, const RealType& value ) { - static_assert( EntityType::entityDimensions == MeshEntityDimensions, "Calling with wrong EntityType -- entity dimensions do not match." ); + static_assert( EntityType::entityDimension == MeshEntityDimension, "Calling with wrong EntityType -- entity dimension do not match." ); this->data.setValue( meshEntity.getIndex(), value ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename EntityType > __cuda_callable__ -typename Functions::MeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType& +MeshFunction< Mesh, MeshEntityDimension, Real >:: operator()( const EntityType& meshEntity, const RealType& time ) { - static_assert( EntityType::entityDimensions == MeshEntityDimensions, "Calling with wrong EntityType -- entity dimensions do not match." ); + static_assert( EntityType::entityDimension == MeshEntityDimension, "Calling with wrong EntityType -- entity dimension do not match." ); return this->data[ meshEntity.getIndex() ]; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename EntityType > __cuda_callable__ -const typename Functions::MeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +const typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType& +MeshFunction< Mesh, MeshEntityDimension, Real >:: operator()( const EntityType& meshEntity, const RealType& time ) const { - static_assert( EntityType::entityDimensions == MeshEntityDimensions, "Calling with wrong EntityType -- entity dimensions do not match." ); + static_assert( EntityType::entityDimension == MeshEntityDimension, "Calling with wrong EntityType -- entity dimension do not match." ); return this->data[ meshEntity.getIndex() ]; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > __cuda_callable__ -typename Functions::MeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType& +MeshFunction< Mesh, MeshEntityDimension, Real >:: operator[]( const IndexType& meshEntityIndex ) { return this->data[ meshEntityIndex ]; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > __cuda_callable__ -const typename Functions::MeshFunction< Mesh, MeshEntityDimensions, Real >::RealType& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +const typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType& +MeshFunction< Mesh, MeshEntityDimension, Real >:: operator[]( const IndexType& meshEntityIndex ) const { return this->data[ meshEntityIndex ]; } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Function > -MeshFunction< Mesh, MeshEntityDimensions, Real >& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >& +MeshFunction< Mesh, MeshEntityDimension, Real >:: operator = ( const Function& f ) { DevicePointer< ThisType > thisDevicePtr( *this ); @@ -382,11 +382,11 @@ operator = ( const Function& f ) } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Function > -MeshFunction< Mesh, MeshEntityDimensions, Real >& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >& +MeshFunction< Mesh, MeshEntityDimension, Real >:: operator += ( const Function& f ) { DevicePointer< ThisType > thisDevicePtr( *this ); @@ -396,11 +396,11 @@ operator += ( const Function& f ) } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > template< typename Function > -MeshFunction< Mesh, MeshEntityDimensions, Real >& -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >& +MeshFunction< Mesh, MeshEntityDimension, Real >:: operator -= ( const Function& f ) { DevicePointer< ThisType > thisDevicePtr( *this ); @@ -410,52 +410,52 @@ operator -= ( const Function& f ) } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > Real -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: getLpNorm( const RealType& p ) const { return MeshFunctionNormGetter< ThisType >::getNorm( *this, p ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > Real -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: getMaxNorm() const { return this->data.absMax(); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > bool -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: save( File& file ) const { - TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(), + TNL_ASSERT( this->data.getSize() == this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(), std::cerr << "this->data.getSize() = " << this->data.getSize() << std::endl - << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() = " << this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >() ); + << "this->mesh->template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() = " << this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >() ); if( ! Object::save( file ) ) return false; return this->data.save( file ); } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > bool -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: load( File& file ) { if( ! Object::load( file ) ) return false; if( ! this->data.load( file ) ) return false; - const IndexType meshSize = this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimensions > >(); + const IndexType meshSize = this->meshPointer.getData().template getEntitiesCount< typename MeshType::template MeshEntity< MeshEntityDimension > >(); if( this->data.getSize() != meshSize ) { std::cerr << "Size of the data loaded to the mesh function (" << this->data.getSize() << ") does not fit with the mesh size (" << meshSize << ")." << std::endl; @@ -465,10 +465,10 @@ load( File& file ) } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > bool -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: boundLoad( File& file ) { if( ! Object::load( file ) ) @@ -477,10 +477,10 @@ boundLoad( File& file ) } template< typename Mesh, - int MeshEntityDimensions, + int MeshEntityDimension, typename Real > bool -MeshFunction< Mesh, MeshEntityDimensions, Real >:: +MeshFunction< Mesh, MeshEntityDimension, Real >:: write( const String& fileName, const String& format ) const { diff --git a/src/TNL/Functions/OperatorFunction.h b/src/TNL/Functions/OperatorFunction.h index 628191165d38d3ae12052091e15b01ba43e852b7..09b674a54b1791e4125f2520eb8c7390ee2054d0 100644 --- a/src/TNL/Functions/OperatorFunction.h +++ b/src/TNL/Functions/OperatorFunction.h @@ -42,7 +42,7 @@ template< typename Operator, typename MeshFunction, typename BoundaryConditions > class OperatorFunction< Operator, MeshFunction, BoundaryConditions, true > - : public Domain< Operator::getMeshDimensions(), MeshDomain > + : public Domain< Operator::getDimension(), MeshDomain > { }; @@ -52,7 +52,7 @@ class OperatorFunction< Operator, MeshFunction, BoundaryConditions, true > template< typename Operator, typename MeshFunctionT > class OperatorFunction< Operator, MeshFunctionT, void, true > - : public Domain< Operator::getDomainDimensions(), Operator::getDomainType() > + : public Domain< Operator::getDomainDimension(), Operator::getDomainType() > { public: @@ -70,10 +70,10 @@ class OperatorFunction< Operator, MeshFunctionT, void, true > typedef typename OperatorType::DeviceType DeviceType; typedef typename OperatorType::IndexType IndexType; typedef typename OperatorType::ExactOperatorType ExactOperatorType; - typedef MeshFunction< MeshType, OperatorType::getPreimageEntitiesDimensions() > PreimageFunctionType; + typedef MeshFunction< MeshType, OperatorType::getPreimageEntitiesDimension() > PreimageFunctionType; typedef SharedPointer< MeshType, DeviceType > MeshPointer; - static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); }; + static constexpr int getEntitiesDimension() { return OperatorType::getImageEntitiesDimension(); }; OperatorFunction( const OperatorType& operator_ ) : operator_( operator_ ), preimageFunction( 0 ){}; @@ -130,7 +130,7 @@ class OperatorFunction< Operator, MeshFunctionT, void, true > template< typename Operator, typename PreimageFunction > class OperatorFunction< Operator, PreimageFunction, void, false > - : public Domain< Operator::getDomainDimensions(), Operator::getDomainType() > + : public Domain< Operator::getDomainDimension(), Operator::getDomainType() > { public: @@ -147,12 +147,12 @@ class OperatorFunction< Operator, PreimageFunction, void, false > typedef typename OperatorType::DeviceType DeviceType; typedef typename OperatorType::IndexType IndexType; typedef PreimageFunction PreimageFunctionType; - typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimensions() > ImageFunctionType; + typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimension() > ImageFunctionType; typedef OperatorFunction< Operator, PreimageFunction, void, true > OperatorFunctionType; typedef typename OperatorType::ExactOperatorType ExactOperatorType; typedef SharedPointer< MeshType, DeviceType > MeshPointer; - static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); }; + static constexpr int getEntitiesDimension() { return OperatorType::getImageEntitiesDimension(); }; OperatorFunction( OperatorType& operator_, const MeshPointer& mesh ) @@ -235,7 +235,7 @@ template< typename Operator, typename PreimageFunction, typename BoundaryConditions > class OperatorFunction< Operator, PreimageFunction, BoundaryConditions, false > - : public Domain< Operator::getMeshDimensions(), MeshDomain > + : public Domain< Operator::getDimension(), MeshDomain > { public: @@ -255,12 +255,12 @@ class OperatorFunction< Operator, PreimageFunction, BoundaryConditions, false > typedef typename OperatorType::DeviceType DeviceType; typedef typename OperatorType::IndexType IndexType; typedef PreimageFunction PreimageFunctionType; - typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimensions() > ImageFunctionType; + typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimension() > ImageFunctionType; typedef BoundaryConditions BoundaryConditionsType; typedef OperatorFunction< Operator, PreimageFunction, void, true > OperatorFunctionType; typedef typename OperatorType::ExactOperatorType ExactOperatorType; - static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); }; + static constexpr int getEntitiesDimension() { return OperatorType::getImageEntitiesDimension(); }; OperatorFunction( OperatorType& operator_, const BoundaryConditionsType& boundaryConditions, diff --git a/src/TNL/Functions/TestFunction.h b/src/TNL/Functions/TestFunction.h index 55e50c4f9df42f064590b06a62fd8622e5ba0492..0e8900399bb00b46134bea3e326f9e14605d8e34 100644 --- a/src/TNL/Functions/TestFunction.h +++ b/src/TNL/Functions/TestFunction.h @@ -19,10 +19,10 @@ namespace TNL { namespace Functions { -template< int FunctionDimensions, +template< int FunctionDimension, typename Real = double, typename Device = Devices::Host > -class TestFunction : public Domain< FunctionDimensions, SpaceDomain > +class TestFunction : public Domain< FunctionDimension, SpaceDomain > { protected: @@ -43,9 +43,9 @@ class TestFunction : public Domain< FunctionDimensions, SpaceDomain > public: - enum{ Dimensions = FunctionDimensions }; + enum{ Dimension = FunctionDimension }; typedef Real RealType; - typedef Containers::StaticVector< Dimensions, Real > VertexType; + typedef Containers::StaticVector< Dimension, Real > PointType; TestFunction(); @@ -67,11 +67,11 @@ class TestFunction : public Domain< FunctionDimensions, SpaceDomain > int ZDiffOrder = 0 > #endif __cuda_callable__ - Real getPartialDerivative( const VertexType& vertex, + Real getPartialDerivative( const PointType& vertex, const Real& time = 0 ) const; __cuda_callable__ - Real operator()( const VertexType& vertex, + Real operator()( const PointType& vertex, const Real& time = 0 ) const { return this->getPartialDerivative< 0, 0, 0 >( vertex, time ); @@ -88,16 +88,16 @@ class TestFunction : public Domain< FunctionDimensions, SpaceDomain > int ZDiffOrder = 0 > #endif __cuda_callable__ - Real getTimeDerivative( const VertexType& vertex, + Real getTimeDerivative( const PointType& vertex, const Real& time = 0 ) const; #ifdef HAVE_NOT_CXX11 - template< typename Vertex > + template< typename Point > __cuda_callable__ - Real getTimeDerivative( const Vertex& vertex, + Real getTimeDerivative( const Point& vertex, const Real& time = 0 ) const { - return this->getTimeDerivative< 0, 0, 0, Vertex >( vertex, time ); + return this->getTimeDerivative< 0, 0, 0, Point >( vertex, time ); } #endif @@ -132,10 +132,10 @@ class TestFunction : public Domain< FunctionDimensions, SpaceDomain > }; -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > -std::ostream& operator << ( std::ostream& str, const TestFunction< FunctionDimensions, Real, Device >& f ) +std::ostream& operator << ( std::ostream& str, const TestFunction< FunctionDimension, Real, Device >& f ) { str << "Test function: "; return f.print( str ); diff --git a/src/TNL/Functions/TestFunction_impl.h b/src/TNL/Functions/TestFunction_impl.h index 506f536518d1946e33da00f749097b168bd8d09d..123832ed275edbe1626876f2320fe036609b24a2 100644 --- a/src/TNL/Functions/TestFunction_impl.h +++ b/src/TNL/Functions/TestFunction_impl.h @@ -28,10 +28,10 @@ namespace TNL { namespace Functions { -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: TestFunction() : function( 0 ), timeDependence( none ), @@ -39,11 +39,11 @@ TestFunction() { } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > void -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: configSetup( Config::ConfigDescription& config, const String& prefix ) { @@ -83,12 +83,12 @@ configSetup( Config::ConfigDescription& config, } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > template< typename FunctionType > bool -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: setupFunction( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -113,11 +113,11 @@ setupFunction( const Config::ParameterContainer& parameters, return true; } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > bool -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: setup( const Config::ParameterContainer& parameters, const String& prefix ) { @@ -143,55 +143,55 @@ setup( const Config::ParameterContainer& parameters, std::cout << "Test function ... " << testFunction << std::endl; if( testFunction == "constant" ) { - typedef Constant< Dimensions, Real > FunctionType; + typedef Constant< Dimension, Real > FunctionType; functionType = constant; return setupFunction< FunctionType >( parameters ); } if( testFunction == "exp-bump" ) { - typedef ExpBump< Dimensions, Real > FunctionType; + typedef ExpBump< Dimension, Real > FunctionType; functionType = expBump; return setupFunction< FunctionType >( parameters ); } if( testFunction == "sin-bumps" ) { - typedef SinBumps< Dimensions, Real > FunctionType; + typedef SinBumps< Dimension, Real > FunctionType; functionType = sinBumps; return setupFunction< FunctionType >( parameters ); } if( testFunction == "sin-wave" ) { - typedef SinWave< Dimensions, Real > FunctionType; + typedef SinWave< Dimension, Real > FunctionType; functionType = sinWave; return setupFunction< FunctionType >( parameters ); } if( testFunction == "cylinder" ) { - typedef Cylinder< Dimensions, Real > FunctionType; + typedef Cylinder< Dimension, Real > FunctionType; functionType = cylinder; return setupFunction< FunctionType >( parameters ); } if( testFunction == "flowerpot" ) { - typedef Flowerpot< Dimensions, Real > FunctionType; + typedef Flowerpot< Dimension, Real > FunctionType; functionType = flowerpot; return setupFunction< FunctionType >( parameters ); } if( testFunction == "twins" ) { - typedef Twins< Dimensions, Real > FunctionType; + typedef Twins< Dimension, Real > FunctionType; functionType = twins; return setupFunction< FunctionType >( parameters ); } if( testFunction == "pseudoSquare" ) { - typedef PseudoSquare< Dimensions, Real > FunctionType; + typedef PseudoSquare< Dimension, Real > FunctionType; functionType = pseudoSquare; return setupFunction< FunctionType >( parameters ); } if( testFunction == "blob" ) { - typedef Blob< Dimensions, Real > FunctionType; + typedef Blob< Dimension, Real > FunctionType; functionType = blob; return setupFunction< FunctionType >( parameters ); } @@ -199,11 +199,11 @@ setup( const Config::ParameterContainer& parameters, return false; } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > -const TestFunction< FunctionDimensions, Real, Device >& -TestFunction< FunctionDimensions, Real, Device >:: +const TestFunction< FunctionDimension, Real, Device >& +TestFunction< FunctionDimension, Real, Device >:: operator = ( const TestFunction& function ) { /***** @@ -220,31 +220,31 @@ operator = ( const TestFunction& function ) switch( this->functionType ) { case constant: - this->copyFunction< Constant< FunctionDimensions, Real > >( function.function ); + this->copyFunction< Constant< FunctionDimension, Real > >( function.function ); break; case expBump: - this->copyFunction< ExpBump< FunctionDimensions, Real > >( function.function ); + this->copyFunction< ExpBump< FunctionDimension, Real > >( function.function ); break; case sinBumps: - this->copyFunction< SinBumps< FunctionDimensions, Real > >( function.function ); + this->copyFunction< SinBumps< FunctionDimension, Real > >( function.function ); break; case sinWave: - this->copyFunction< SinWave< FunctionDimensions, Real > >( function.function ); + this->copyFunction< SinWave< FunctionDimension, Real > >( function.function ); break; case cylinder: - this->copyFunction< Cylinder< FunctionDimensions, Real > >( function.function ); + this->copyFunction< Cylinder< FunctionDimension, Real > >( function.function ); break; case flowerpot: - this->copyFunction< Flowerpot< FunctionDimensions, Real > >( function.function ); + this->copyFunction< Flowerpot< FunctionDimension, Real > >( function.function ); break; case twins: - this->copyFunction< Twins< FunctionDimensions, Real > >( function.function ); + this->copyFunction< Twins< FunctionDimension, Real > >( function.function ); break; case pseudoSquare: - this->copyFunction< PseudoSquare< FunctionDimensions, Real > >( function.function ); + this->copyFunction< PseudoSquare< FunctionDimension, Real > >( function.function ); break; case blob: - this->copyFunction< Blob< FunctionDimensions, Real > >( function.function ); + this->copyFunction< Blob< FunctionDimension, Real > >( function.function ); break; default: TNL_ASSERT( false, ); @@ -253,7 +253,7 @@ operator = ( const TestFunction& function ) } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > template< int XDiffOrder, @@ -261,8 +261,8 @@ template< int FunctionDimensions, int ZDiffOrder > __cuda_callable__ Real -TestFunction< FunctionDimensions, Real, Device >:: -getPartialDerivative( const VertexType& vertex, +TestFunction< FunctionDimension, Real, Device >:: +getPartialDerivative( const PointType& vertex, const Real& time ) const { using namespace TNL::Functions::Analytic; @@ -286,38 +286,38 @@ getPartialDerivative( const VertexType& vertex, switch( functionType ) { case constant: - return scale * ( ( Constant< Dimensions, Real >* ) function )-> + return scale * ( ( Constant< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case expBump: - return scale * ( ( ExpBump< Dimensions, Real >* ) function )-> + return scale * ( ( ExpBump< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinBumps: - return scale * ( ( SinBumps< Dimensions, Real >* ) function )-> + return scale * ( ( SinBumps< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinWave: - return scale * ( ( SinWave< Dimensions, Real >* ) function )-> + return scale * ( ( SinWave< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case cylinder: - return scale * ( ( Cylinder< Dimensions, Real >* ) function )-> + return scale * ( ( Cylinder< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case flowerpot: - return scale * ( ( Flowerpot< Dimensions, Real >* ) function )-> + return scale * ( ( Flowerpot< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case twins: - return scale * ( ( Twins< Dimensions, Real >* ) function )-> + return scale * ( ( Twins< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case pseudoSquare: - return scale * ( ( PseudoSquare< Dimensions, Real >* ) function )-> + return scale * ( ( PseudoSquare< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case blob: - return scale * ( ( Blob< Dimensions, Real >* ) function )-> + return scale * ( ( Blob< Dimension, Real >* ) function )-> template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); default: return 0.0; } } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > template< int XDiffOrder, @@ -325,8 +325,8 @@ template< int FunctionDimensions, int ZDiffOrder > __cuda_callable__ Real -TestFunction< FunctionDimensions, Real, Device >:: -getTimeDerivative( const VertexType& vertex, +TestFunction< FunctionDimension, Real, Device >:: +getTimeDerivative( const PointType& vertex, const Real& time ) const { using namespace TNL::Functions::Analytic; @@ -348,36 +348,36 @@ getTimeDerivative( const VertexType& vertex, switch( functionType ) { case constant: - return scale * ( ( Constant< Dimensions, Real >* ) function )-> + return scale * ( ( Constant< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case expBump: - return scale * ( ( ExpBump< Dimensions, Real >* ) function )-> + return scale * ( ( ExpBump< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinBumps: - return scale * ( ( SinBumps< Dimensions, Real >* ) function )-> + return scale * ( ( SinBumps< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinWave: - return scale * ( ( SinWave< Dimensions, Real >* ) function )-> + return scale * ( ( SinWave< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); break; case cylinder: - return scale * ( ( Cylinder< Dimensions, Real >* ) function )-> + return scale * ( ( Cylinder< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); break; case flowerpot: - return scale * ( ( Flowerpot< Dimensions, Real >* ) function )-> + return scale * ( ( Flowerpot< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); break; case twins: - return scale * ( ( Twins< Dimensions, Real >* ) function )-> + return scale * ( ( Twins< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); break; case pseudoSquare: - return scale * ( ( PseudoSquare< Dimensions, Real >* ) function )-> + return scale * ( ( PseudoSquare< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); break; case blob: - return scale * ( ( Blob< Dimensions, Real >* ) function )-> + return scale * ( ( Blob< Dimension, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); break; default: @@ -385,12 +385,12 @@ getTimeDerivative( const VertexType& vertex, } } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > template< typename FunctionType > void -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: deleteFunction() { if( std::is_same< Device, Devices::Host >::value ) @@ -405,52 +405,52 @@ deleteFunction() } } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > void -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: deleteFunctions() { using namespace TNL::Functions::Analytic; switch( functionType ) { case constant: - deleteFunction< Constant< Dimensions, Real> >(); + deleteFunction< Constant< Dimension, Real> >(); break; case expBump: - deleteFunction< ExpBump< Dimensions, Real> >(); + deleteFunction< ExpBump< Dimension, Real> >(); break; case sinBumps: - deleteFunction< SinBumps< Dimensions, Real> >(); + deleteFunction< SinBumps< Dimension, Real> >(); break; case sinWave: - deleteFunction< SinWave< Dimensions, Real> >(); + deleteFunction< SinWave< Dimension, Real> >(); break; case cylinder: - deleteFunction< Cylinder< Dimensions, Real> >(); + deleteFunction< Cylinder< Dimension, Real> >(); break; case flowerpot: - deleteFunction< Flowerpot< Dimensions, Real> >(); + deleteFunction< Flowerpot< Dimension, Real> >(); break; case twins: - deleteFunction< Twins< Dimensions, Real> >(); + deleteFunction< Twins< Dimension, Real> >(); break; case pseudoSquare: - deleteFunction< PseudoSquare< Dimensions, Real> >(); + deleteFunction< PseudoSquare< Dimension, Real> >(); break; case blob: - deleteFunction< Blob< Dimensions, Real> >(); + deleteFunction< Blob< Dimension, Real> >(); break; } } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > template< typename FunctionType > void -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: copyFunction( const void* function ) { if( std::is_same< Device, Devices::Host >::value ) @@ -465,12 +465,12 @@ copyFunction( const void* function ) } } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > template< typename FunctionType > std::ostream& -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: printFunction( std::ostream& str ) const { FunctionType* f = ( FunctionType* ) this->function; @@ -487,11 +487,11 @@ printFunction( std::ostream& str ) const return str; } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > std::ostream& -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: print( std::ostream& str ) const { using namespace TNL::Functions::Analytic; @@ -501,31 +501,31 @@ print( std::ostream& str ) const switch( functionType ) { case constant: - return printFunction< Constant< Dimensions, Real> >( str ); + return printFunction< Constant< Dimension, Real> >( str ); case expBump: - return printFunction< ExpBump< Dimensions, Real> >( str ); + return printFunction< ExpBump< Dimension, Real> >( str ); case sinBumps: - return printFunction< SinBumps< Dimensions, Real> >( str ); + return printFunction< SinBumps< Dimension, Real> >( str ); case sinWave: - return printFunction< SinWave< Dimensions, Real> >( str ); + return printFunction< SinWave< Dimension, Real> >( str ); case cylinder: - return printFunction< Cylinder< Dimensions, Real> >( str ); + return printFunction< Cylinder< Dimension, Real> >( str ); case flowerpot: - return printFunction< Flowerpot< Dimensions, Real> >( str ); + return printFunction< Flowerpot< Dimension, Real> >( str ); case twins: - return printFunction< Twins< Dimensions, Real> >( str ); + return printFunction< Twins< Dimension, Real> >( str ); case pseudoSquare: - return printFunction< PseudoSquare< Dimensions, Real> >( str ); + return printFunction< PseudoSquare< Dimension, Real> >( str ); case blob: - return printFunction< Blob< Dimensions, Real> >( str ); + return printFunction< Blob< Dimension, Real> >( str ); } return str; } -template< int FunctionDimensions, +template< int FunctionDimension, typename Real, typename Device > -TestFunction< FunctionDimensions, Real, Device >:: +TestFunction< FunctionDimension, Real, Device >:: ~TestFunction() { deleteFunctions(); diff --git a/src/TNL/Images/RegionOfInterest_impl.h b/src/TNL/Images/RegionOfInterest_impl.h index 387b6fb341dda9267c010aa8c8275fb0a89d5b65..e8469670b7e6e060a40be70c540a763f021322b5 100644 --- a/src/TNL/Images/RegionOfInterest_impl.h +++ b/src/TNL/Images/RegionOfInterest_impl.h @@ -163,7 +163,7 @@ setGrid( Grid& grid, bool verbose ) { grid.setDimensions( this->getWidth(), this->getHeight() ); - typename Grid::VertexType origin, proportions; + typename Grid::PointType origin, proportions; origin.x() = 0.0; origin.y() = 0.0; proportions.x() = 1.0; diff --git a/src/TNL/Matrices/CSR.h b/src/TNL/Matrices/CSR.h index 7c249944bfdd7ef062078f274492cb033d183eb5..bc06d7c2c0872744befb483db48c5b657a7d2f9e 100644 --- a/src/TNL/Matrices/CSR.h +++ b/src/TNL/Matrices/CSR.h @@ -35,7 +35,7 @@ class CSR : public Sparse< Real, Device, Index > typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename Sparse< RealType, DeviceType, IndexType >:: CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Sparse< RealType, DeviceType, IndexType >:: CompressedRowLengthsVector CompressedRowLengthsVector; typedef CSR< Real, Device, Index > ThisType; typedef CSR< Real, Devices::Host, Index > HostType; typedef CSR< Real, Devices::Cuda, Index > CudaType; @@ -55,7 +55,7 @@ class CSR : public Sparse< Real, Device, Index > bool setDimensions( const IndexType rows, const IndexType columns ); - bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ); + bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); IndexType getRowLength( const IndexType row ) const; diff --git a/src/TNL/Matrices/CSR_impl.h b/src/TNL/Matrices/CSR_impl.h index e021dc52c466788bbc39b6552e71420fb128be6d..6084df88a8afb4c7bb2389e356e438df71059b4c 100644 --- a/src/TNL/Matrices/CSR_impl.h +++ b/src/TNL/Matrices/CSR_impl.h @@ -74,7 +74,7 @@ bool CSR< Real, Device, Index >::setDimensions( const IndexType rows, template< typename Real, typename Device, typename Index > -bool CSR< Real, Device, Index >::setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) +bool CSR< Real, Device, Index >::setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) { /**** * Compute the rows pointers. The last one is diff --git a/src/TNL/Matrices/ChunkedEllpack.h b/src/TNL/Matrices/ChunkedEllpack.h index a6a1d96f712fe6ba5b619f1a8ee4de9428fa6ad3..299f85f5d6b95f4833153a4fc403c92c9603570b 100644 --- a/src/TNL/Matrices/ChunkedEllpack.h +++ b/src/TNL/Matrices/ChunkedEllpack.h @@ -68,7 +68,7 @@ class ChunkedEllpack : public Sparse< Real, Device, Index > typedef Device DeviceType; typedef Index IndexType; typedef tnlChunkedEllpackSliceInfo< IndexType > ChunkedEllpackSliceInfo; - typedef typename Sparse< RealType, DeviceType, IndexType >:: CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Sparse< RealType, DeviceType, IndexType >:: CompressedRowLengthsVector CompressedRowLengthsVector; typedef ChunkedEllpack< Real, Device, Index > ThisType; typedef ChunkedEllpack< Real, Devices::Host, Index > HostType; typedef ChunkedEllpack< Real, Devices::Cuda, Index > CudaType; @@ -84,7 +84,7 @@ class ChunkedEllpack : public Sparse< Real, Device, Index > bool setDimensions( const IndexType rows, const IndexType columns ); - bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ); + bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); IndexType getRowLength( const IndexType row ) const; @@ -232,7 +232,7 @@ class ChunkedEllpack : public Sparse< Real, Device, Index > void resolveSliceSizes( const Containers::Vector< Index, Devices::Host, Index >& rowLengths ); - bool setSlice( const CompressedRowsLengthsVector& rowLengths, + bool setSlice( const CompressedRowLengthsVector& rowLengths, const IndexType sliceIdx, IndexType& elementsToAllocation ); diff --git a/src/TNL/Matrices/ChunkedEllpack_impl.h b/src/TNL/Matrices/ChunkedEllpack_impl.h index eb4bfd9f35d86f1800f33917ea6c6baaf14c4f1a..6addfa7a3241f29d2eec07b2fc8b9ece99b917f7 100644 --- a/src/TNL/Matrices/ChunkedEllpack_impl.h +++ b/src/TNL/Matrices/ChunkedEllpack_impl.h @@ -123,7 +123,7 @@ void ChunkedEllpack< Real, Device, Index >::resolveSliceSizes( const Containers: template< typename Real, typename Device, typename Index > -bool ChunkedEllpack< Real, Device, Index >::setSlice( const CompressedRowsLengthsVector& rowLengths, +bool ChunkedEllpack< Real, Device, Index >::setSlice( const CompressedRowLengthsVector& rowLengths, const IndexType sliceIndex, IndexType& elementsToAllocation ) { @@ -206,7 +206,7 @@ bool ChunkedEllpack< Real, Device, Index >::setSlice( const CompressedRowsLength template< typename Real, typename Device, typename Index > -bool ChunkedEllpack< Real, Device, Index >::setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) +bool ChunkedEllpack< Real, Device, Index >::setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) { TNL_ASSERT( this->getRows() > 0, ); TNL_ASSERT( this->getColumns() > 0, ); @@ -226,12 +226,12 @@ bool ChunkedEllpack< Real, Device, Index >::setCompressedRowsLengths( const Comp { ChunkedEllpack< RealType, Devices::Host, IndexType > hostMatrix; hostMatrix.setDimensions( this->getRows(), this->getColumns() ); - Containers::Vector< IndexType, Devices::Host, IndexType > hostCompressedRowsLengths; - hostCompressedRowsLengths.setLike( rowLengths); - hostCompressedRowsLengths = rowLengths; + Containers::Vector< IndexType, Devices::Host, IndexType > hostCompressedRowLengths; + hostCompressedRowLengths.setLike( rowLengths); + hostCompressedRowLengths = rowLengths; hostMatrix.setNumberOfChunksInSlice( this->chunksInSlice ); hostMatrix.setDesiredChunkSize( this->desiredChunkSize ); - hostMatrix.setCompressedRowsLengths( hostCompressedRowsLengths ); + hostMatrix.setCompressedRowLengths( hostCompressedRowLengths ); this->rowToChunkMapping.setLike( hostMatrix.rowToChunkMapping ); this->rowToChunkMapping = hostMatrix.rowToChunkMapping; @@ -1276,7 +1276,7 @@ class ChunkedEllpackDeviceDependentCode< Devices::Host > template< typename Real, typename Index > static void resolveSliceSizes( ChunkedEllpack< Real, Device, Index >& matrix, - const typename ChunkedEllpack< Real, Device, Index >::CompressedRowsLengthsVector& rowLengths ) + const typename ChunkedEllpack< Real, Device, Index >::CompressedRowLengthsVector& rowLengths ) { matrix.resolveSliceSizes( rowLengths ); } @@ -1337,7 +1337,7 @@ class ChunkedEllpackDeviceDependentCode< Devices::Cuda > template< typename Real, typename Index > static void resolveSliceSizes( ChunkedEllpack< Real, Device, Index >& matrix, - const typename ChunkedEllpack< Real, Device, Index >::CompressedRowsLengthsVector& rowLengths ) + const typename ChunkedEllpack< Real, Device, Index >::CompressedRowLengthsVector& rowLengths ) { } diff --git a/src/TNL/Matrices/Dense.h b/src/TNL/Matrices/Dense.h index f95c4b626e70d64c4fb41e3cc012fde5a04e6b43..10145c1b9240238feff4a826832021dabc204b18 100644 --- a/src/TNL/Matrices/Dense.h +++ b/src/TNL/Matrices/Dense.h @@ -31,7 +31,7 @@ class Dense : public Matrix< Real, Device, Index > typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename Matrix< Real, Device, Index >::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Matrix< Real, Device, Index >::CompressedRowLengthsVector CompressedRowLengthsVector; typedef Dense< Real, Device, Index > ThisType; typedef Dense< Real, Devices::Host, Index > HostType; typedef Dense< Real, Devices::Cuda, Index > CudaType; @@ -54,7 +54,7 @@ class Dense : public Matrix< Real, Device, Index > /**** * This method is only for the compatibility with the sparse matrices. */ - bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ); + bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); /**** * Returns maximal number of the nonzero matrix elements that can be stored diff --git a/src/TNL/Matrices/Dense_impl.h b/src/TNL/Matrices/Dense_impl.h index 783e3b6035a8120c2525da5a9832dd86ecef28ae..167e6a424052af62911076b26bcf09bc3c1c059b 100644 --- a/src/TNL/Matrices/Dense_impl.h +++ b/src/TNL/Matrices/Dense_impl.h @@ -73,7 +73,7 @@ bool Dense< Real, Device, Index >::setLike( const Dense< Real2, Device2, Index2 template< typename Real, typename Device, typename Index > -bool Dense< Real, Device, Index >::setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) +bool Dense< Real, Device, Index >::setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) { return true; } diff --git a/src/TNL/Matrices/Ellpack.h b/src/TNL/Matrices/Ellpack.h index 64bb18123d1011cb0678c62bcf57936d98617aed..0082d414dcc545875c1d8473526ec5fbfbd5cd0b 100644 --- a/src/TNL/Matrices/Ellpack.h +++ b/src/TNL/Matrices/Ellpack.h @@ -27,7 +27,7 @@ class Ellpack : public Sparse< Real, Device, Index > typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename Sparse< RealType, DeviceType, IndexType >::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Sparse< RealType, DeviceType, IndexType >::CompressedRowLengthsVector CompressedRowLengthsVector; typedef typename Sparse< RealType, DeviceType, IndexType >::ValuesVector ValuesVector; typedef typename Sparse< RealType, DeviceType, IndexType >::ColumnIndexesVector ColumnIndexesVector; typedef Ellpack< Real, Device, Index > ThisType; @@ -46,9 +46,9 @@ class Ellpack : public Sparse< Real, Device, Index > bool setDimensions( const IndexType rows, const IndexType columns ); - bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ); + bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); - bool setConstantCompressedRowsLengths( const IndexType& rowLengths ); + bool setConstantCompressedRowLengths( const IndexType& rowLengths ); IndexType getRowLength( const IndexType row ) const; @@ -65,7 +65,7 @@ class Ellpack : public Sparse< Real, Device, Index > /*template< typename Matrix > bool copyFrom( const Matrix& matrix, - const CompressedRowsLengthsVector& rowLengths );*/ + const CompressedRowLengthsVector& rowLengths );*/ __cuda_callable__ bool setElementFast( const IndexType row, diff --git a/src/TNL/Matrices/Ellpack_impl.h b/src/TNL/Matrices/Ellpack_impl.h index c183b4777368e49a30b9b8ba5e6efa97e52c2591..6a98fd86b280a6a30c94fc6bf2fa641f064cb0b8 100644 --- a/src/TNL/Matrices/Ellpack_impl.h +++ b/src/TNL/Matrices/Ellpack_impl.h @@ -69,7 +69,7 @@ bool Ellpack< Real, Device, Index >::setDimensions( const IndexType rows, template< typename Real, typename Device, typename Index > -bool Ellpack< Real, Device, Index >::setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) +bool Ellpack< Real, Device, Index >::setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) { TNL_ASSERT( this->getRows() > 0, ); TNL_ASSERT( this->getColumns() > 0, ); @@ -81,7 +81,7 @@ bool Ellpack< Real, Device, Index >::setCompressedRowsLengths( const CompressedR template< typename Real, typename Device, typename Index > -bool Ellpack< Real, Device, Index >::setConstantCompressedRowsLengths( const IndexType& rowLengths ) +bool Ellpack< Real, Device, Index >::setConstantCompressedRowLengths( const IndexType& rowLengths ) { TNL_ASSERT( rowLengths > 0, std::cerr << " rowLengths = " << rowLengths ); @@ -158,7 +158,7 @@ bool Ellpack< Real, Device, Index >::operator != ( const Ellpack< Real2, Device2 typename Index > template< typename Matrix > bool Ellpack< Real, Device, Index >::copyFrom( const Matrix& matrix, - const CompressedRowsLengthsVector& rowLengths ) + const CompressedRowLengthsVector& rowLengths ) { return Matrix< RealType, DeviceType, IndexType >::copyFrom( matrix, rowLengths ); }*/ @@ -706,7 +706,7 @@ template< __global__ void EllpackVectorProductCudaKernel( const Index rows, const Index columns, - const Index compressedRowsLengths, + const Index compressedRowLengths, const Index alignedRows, const Index paddingIndex, const Index* columnIndexes, @@ -722,7 +722,7 @@ __global__ void EllpackVectorProductCudaKernel( Index el( 0 ); Real result( 0.0 ); Index columnIndex; - while( el++ < compressedRowsLengths && + while( el++ < compressedRowLengths && ( columnIndex = columnIndexes[ i ] ) < columns && columnIndex != paddingIndex ) { diff --git a/src/TNL/Matrices/Matrix.h b/src/TNL/Matrices/Matrix.h index 57e95defa1219fd27eb79b24e954df3a4ee1defa..f8117165c4355068dc8cc083370f34165f74e4c2 100644 --- a/src/TNL/Matrices/Matrix.h +++ b/src/TNL/Matrices/Matrix.h @@ -27,7 +27,7 @@ class Matrix : public virtual Object typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef Containers::Vector< IndexType, DeviceType, IndexType > CompressedRowsLengthsVector; + typedef Containers::Vector< IndexType, DeviceType, IndexType > CompressedRowLengthsVector; typedef Containers::Vector< RealType, DeviceType, IndexType > ValuesVector; Matrix(); @@ -35,11 +35,11 @@ class Matrix : public virtual Object virtual bool setDimensions( const IndexType rows, const IndexType columns ); - virtual bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) = 0; + virtual bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) = 0; virtual IndexType getRowLength( const IndexType row ) const = 0; - virtual void getCompressedRowsLengths( Containers::Vector< IndexType, DeviceType, IndexType >& rowLengths ) const; + virtual void getCompressedRowLengths( Containers::Vector< IndexType, DeviceType, IndexType >& rowLengths ) const; template< typename Real2, typename Device2, typename Index2 > bool setLike( const Matrix< Real2, Device2, Index2 >& matrix ); @@ -95,7 +95,7 @@ class Matrix : public virtual Object template< typename Matrix > bool copyFrom( const Matrix& matrix, - const CompressedRowsLengthsVector& rowLengths ); + const CompressedRowLengthsVector& rowLengths ); virtual bool save( File& file ) const; diff --git a/src/TNL/Matrices/MatrixReader.h b/src/TNL/Matrices/MatrixReader.h index 1bcb88842a65455b9e93bf4620af9a9748cbdbfb..fb9788b5fbd736b8448660f1f8cd20a5ec44a7a9 100644 --- a/src/TNL/Matrices/MatrixReader.h +++ b/src/TNL/Matrices/MatrixReader.h @@ -39,7 +39,7 @@ class MatrixReader static bool readMtxFileHostMatrix( std::istream& file, Matrix& matrix, - typename Matrix::CompressedRowsLengthsVector& rowLengths, + typename Matrix::CompressedRowLengthsVector& rowLengths, bool verbose ); @@ -63,7 +63,7 @@ class MatrixReader bool& symmetricMatrix, bool verbose ); - static bool computeCompressedRowsLengthsFromMtxFile( std::istream& file, + static bool computeCompressedRowLengthsFromMtxFile( std::istream& file, Containers::Vector< int, Devices::Host, int >& rowLengths, const int columns, const int rows, diff --git a/src/TNL/Matrices/MatrixReader_impl.h b/src/TNL/Matrices/MatrixReader_impl.h index 87ddf93d3b7bfa665d5f0e441c6c74a99294857d..4d0058e5aa6892430f9e84248734c684ad130e8f 100644 --- a/src/TNL/Matrices/MatrixReader_impl.h +++ b/src/TNL/Matrices/MatrixReader_impl.h @@ -45,7 +45,7 @@ bool MatrixReader< Matrix >::readMtxFile( std::istream& file, template< typename Matrix > bool MatrixReader< Matrix >::readMtxFileHostMatrix( std::istream& file, Matrix& matrix, - typename Matrix::CompressedRowsLengthsVector& rowLengths, + typename Matrix::CompressedRowLengthsVector& rowLengths, bool verbose ) { IndexType rows, columns; @@ -62,10 +62,10 @@ bool MatrixReader< Matrix >::readMtxFileHostMatrix( std::istream& file, return false; } - if( ! computeCompressedRowsLengthsFromMtxFile( file, rowLengths, columns, rows, symmetricMatrix, verbose ) ) + if( ! computeCompressedRowLengthsFromMtxFile( file, rowLengths, columns, rows, symmetricMatrix, verbose ) ) return false; - if( ! matrix.setCompressedRowsLengths( rowLengths ) ) + if( ! matrix.setCompressedRowLengths( rowLengths ) ) return false; if( ! readMatrixElementsFromMtxFile( file, matrix, symmetricMatrix, verbose ) ) @@ -252,7 +252,7 @@ bool MatrixReader< Matrix >::readMtxHeader( std::istream& file, } template< typename Matrix > -bool MatrixReader< Matrix >::computeCompressedRowsLengthsFromMtxFile( std::istream& file, +bool MatrixReader< Matrix >::computeCompressedRowLengthsFromMtxFile( std::istream& file, Containers::Vector< int, Devices::Host, int >& rowLengths, const int columns, const int rows, @@ -387,7 +387,7 @@ class MatrixReaderDeviceDependentCode< Devices::Host > Matrix& matrix, bool verbose ) { - typename Matrix::CompressedRowsLengthsVector rowLengths; + typename Matrix::CompressedRowLengthsVector rowLengths; return MatrixReader< Matrix >::readMtxFileHostMatrix( file, matrix, rowLengths, verbose ); } }; @@ -403,17 +403,17 @@ class MatrixReaderDeviceDependentCode< Devices::Cuda > bool verbose ) { typedef typename Matrix::HostType HostMatrixType; - typedef typename HostMatrixType::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename HostMatrixType::CompressedRowLengthsVector CompressedRowLengthsVector; HostMatrixType hostMatrix; - CompressedRowsLengthsVector rowLengthsVector; + CompressedRowLengthsVector rowLengthsVector; if( ! MatrixReader< HostMatrixType >::readMtxFileHostMatrix( file, hostMatrix, rowLengthsVector, verbose ) ) return false; - typename Matrix::CompressedRowsLengthsVector cudaCompressedRowsLengthsVector; - cudaCompressedRowsLengthsVector.setLike( rowLengthsVector ); - cudaCompressedRowsLengthsVector = rowLengthsVector; - if( ! matrix.copyFrom( hostMatrix, cudaCompressedRowsLengthsVector ) ) + typename Matrix::CompressedRowLengthsVector cudaCompressedRowLengthsVector; + cudaCompressedRowLengthsVector.setLike( rowLengthsVector ); + cudaCompressedRowLengthsVector = rowLengthsVector; + if( ! matrix.copyFrom( hostMatrix, cudaCompressedRowLengthsVector ) ) return false; return true; } diff --git a/src/TNL/Matrices/MatrixSetter.h b/src/TNL/Matrices/MatrixSetter.h index 8eae6671851112a2fb22ad19611437d59a030377..8dd15f6a75c4079c20f6801168c4a0ec81da12be 100644 --- a/src/TNL/Matrices/MatrixSetter.h +++ b/src/TNL/Matrices/MatrixSetter.h @@ -15,22 +15,22 @@ namespace Matrices { template< typename DifferentialOperator, typename BoundaryConditions, - typename CompressedRowsLengthsVector > + typename CompressedRowLengthsVector > class MatrixSetterTraversalUserData { public: - typedef typename CompressedRowsLengthsVector::DeviceType DeviceType; + typedef typename CompressedRowLengthsVector::DeviceType DeviceType; const DifferentialOperator* differentialOperator; const BoundaryConditions* boundaryConditions; - CompressedRowsLengthsVector* rowLengths; + CompressedRowLengthsVector* rowLengths; MatrixSetterTraversalUserData( const DifferentialOperator* differentialOperator, const BoundaryConditions* boundaryConditions, - CompressedRowsLengthsVector* rowLengths ) + CompressedRowLengthsVector* rowLengths ) : differentialOperator( differentialOperator ), boundaryConditions( boundaryConditions ), rowLengths( rowLengths ) @@ -41,26 +41,26 @@ class MatrixSetterTraversalUserData template< typename Mesh, typename DifferentialOperator, typename BoundaryConditions, - typename CompressedRowsLengthsVector > + typename CompressedRowLengthsVector > class MatrixSetter { public: typedef Mesh MeshType; typedef SharedPointer< MeshType > MeshPointer; typedef typename MeshType::DeviceType DeviceType; - typedef typename CompressedRowsLengthsVector::RealType IndexType; + typedef typename CompressedRowLengthsVector::RealType IndexType; typedef MatrixSetterTraversalUserData< DifferentialOperator, BoundaryConditions, - CompressedRowsLengthsVector > TraversalUserData; + CompressedRowLengthsVector > TraversalUserData; typedef SharedPointer< DifferentialOperator, DeviceType > DifferentialOperatorPointer; typedef SharedPointer< BoundaryConditions, DeviceType > BoundaryConditionsPointer; - typedef SharedPointer< CompressedRowsLengthsVector, DeviceType > CompressedRowsLengthsVectorPointer; + typedef SharedPointer< CompressedRowLengthsVector, DeviceType > CompressedRowLengthsVectorPointer; template< typename EntityType > - void getCompressedRowsLengths( const MeshPointer& meshPointer, + void getCompressedRowLengths( const MeshPointer& meshPointer, const DifferentialOperatorPointer& differentialOperatorPointer, const BoundaryConditionsPointer& boundaryConditionsPointer, - CompressedRowsLengthsVectorPointer& rowLengthsPointer ) const; + CompressedRowLengthsVectorPointer& rowLengthsPointer ) const; class TraversalBoundaryEntitiesProcessor { @@ -97,32 +97,32 @@ class MatrixSetter }; /* -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename DifferentialOperator, typename BoundaryConditions, - typename CompressedRowsLengthsVector > -class MatrixSetter< Meshes::Grid< Dimensions, Real, Device, Index >, + typename CompressedRowLengthsVector > +class MatrixSetter< Meshes::Grid< Dimension, Real, Device, Index >, DifferentialOperator, BoundaryConditions, - CompressedRowsLengthsVector > + CompressedRowLengthsVector > { public: - typedef Meshes::Grid< Dimensions, Real, Device, Index > MeshType; + typedef Meshes::Grid< Dimension, Real, Device, Index > MeshType; typedef typename MeshType::DeviceType DeviceType; - typedef typename CompressedRowsLengthsVector::RealType IndexType; + typedef typename CompressedRowLengthsVector::RealType IndexType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef MatrixSetterTraversalUserData< DifferentialOperator, BoundaryConditions, - CompressedRowsLengthsVector > TraversalUserData; + CompressedRowLengthsVector > TraversalUserData; template< typename EntityType > - void getCompressedRowsLengths( const MeshType& mesh, + void getCompressedRowLengths( const MeshType& mesh, const DifferentialOperator& differentialOperator, const BoundaryConditions& boundaryConditions, - CompressedRowsLengthsVector& rowLengths ) const; + CompressedRowLengthsVector& rowLengths ) const; class TraversalBoundaryEntitiesProcessor { diff --git a/src/TNL/Matrices/MatrixSetter_impl.h b/src/TNL/Matrices/MatrixSetter_impl.h index d67feadb9ca01fce69089e7b66d180ee88cc8ecf..98f39be7087c890f29edd8ce1e3d4777cb875479 100644 --- a/src/TNL/Matrices/MatrixSetter_impl.h +++ b/src/TNL/Matrices/MatrixSetter_impl.h @@ -18,14 +18,14 @@ namespace Matrices { template< typename Mesh, typename DifferentialOperator, typename BoundaryConditions, - typename CompressedRowsLengthsVector > + typename CompressedRowLengthsVector > template< typename EntityType > void -MatrixSetter< Mesh, DifferentialOperator, BoundaryConditions, CompressedRowsLengthsVector >:: -getCompressedRowsLengths( const MeshPointer& meshPointer, +MatrixSetter< Mesh, DifferentialOperator, BoundaryConditions, CompressedRowLengthsVector >:: +getCompressedRowLengths( const MeshPointer& meshPointer, const DifferentialOperatorPointer& differentialOperatorPointer, const BoundaryConditionsPointer& boundaryConditionsPointer, - CompressedRowsLengthsVectorPointer& rowLengthsPointer ) const + CompressedRowLengthsVectorPointer& rowLengthsPointer ) const { { SharedPointer< TraversalUserData, DeviceType > diff --git a/src/TNL/Matrices/Matrix_impl.h b/src/TNL/Matrices/Matrix_impl.h index 19e40ae200eaabb1c27ca2e4054b3c23c6c726d6..fb881d16f2eb01845750026525425345bc4167b5 100644 --- a/src/TNL/Matrices/Matrix_impl.h +++ b/src/TNL/Matrices/Matrix_impl.h @@ -41,7 +41,7 @@ template< typename Real, template< typename Real, typename Device, typename Index > -void Matrix< Real, Device, Index >::getCompressedRowsLengths( Containers::Vector< IndexType, DeviceType, IndexType >& rowLengths ) const +void Matrix< Real, Device, Index >::getCompressedRowLengths( Containers::Vector< IndexType, DeviceType, IndexType >& rowLengths ) const { rowLengths.setSize( this->getRows() ); for( IndexType row = 0; row < this->getRows(); row++ ) @@ -91,13 +91,13 @@ template< typename Real, typename Index > template< typename MatrixT > bool Matrix< Real, Device, Index >::copyFrom( const MatrixT& matrix, - const CompressedRowsLengthsVector& rowLengths ) + const CompressedRowLengthsVector& rowLengths ) { /*tnlStaticTNL_ASSERT( DeviceType::DeviceType == Devices::HostDevice, ); tnlStaticTNL_ASSERT( DeviceType::DeviceType == Matrix:DeviceType::DeviceType, );*/ this->setLike( matrix ); - if( ! this->setCompressedRowsLengths( rowLengths ) ) + if( ! this->setCompressedRowLengths( rowLengths ) ) return false; Containers::Vector< RealType, Devices::Host, IndexType > values; Containers::Vector< IndexType, Devices::Host, IndexType > columns; @@ -122,8 +122,8 @@ Matrix< Real, Device, Index >& Matrix< Real, Device, Index >::operator = ( const this->setLike( m ); Containers::Vector< IndexType, DeviceType, IndexType > rowLengths; - m.getCompressedRowsLengths( rowLengths ); - this->setCompressedRowsLengths( rowLengths ); + m.getCompressedRowLengths( rowLengths ); + this->setCompressedRowLengths( rowLengths ); Containers::Vector< RealType, DeviceType, IndexType > rowValues; Containers::Vector< IndexType, DeviceType, IndexType > rowColumns; diff --git a/src/TNL/Matrices/Multidiagonal.h b/src/TNL/Matrices/Multidiagonal.h index 407178fe29c4840e5694e1ff4db3adf73c9ab482..5acd602ac2a7b4c34b3a52d99a34f2297c71c527 100644 --- a/src/TNL/Matrices/Multidiagonal.h +++ b/src/TNL/Matrices/Multidiagonal.h @@ -28,7 +28,7 @@ class Multidiagonal : public Matrix< Real, Device, Index > typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename Matrix< Real, Device, Index >::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Matrix< Real, Device, Index >::CompressedRowLengthsVector CompressedRowLengthsVector; typedef Multidiagonal< Real, Device, Index > ThisType; typedef Multidiagonal< Real, Devices::Host, Index > HostType; typedef Multidiagonal< Real, Devices::Cuda, Index > CudaType; @@ -45,7 +45,7 @@ class Multidiagonal : public Matrix< Real, Device, Index > bool setDimensions( const IndexType rows, const IndexType columns ); - bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ); + bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); IndexType getRowLength( const IndexType row ) const; diff --git a/src/TNL/Matrices/MultidiagonalMatrixSetter.h b/src/TNL/Matrices/MultidiagonalMatrixSetter.h index f49e92fa57f052e37b5b60a2cfe56641aa477ef2..d25a21581802f63b1b16b83ed91649014a3b16df 100644 --- a/src/TNL/Matrices/MultidiagonalMatrixSetter.h +++ b/src/TNL/Matrices/MultidiagonalMatrixSetter.h @@ -31,7 +31,7 @@ class MultidiagonalMatrixSetter< Meshes::Grid< 1, MeshReal, Device, MeshIndex > typedef MeshIndex MeshIndexType; typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; - enum { Dimensions = 1 }; + enum { Dimension = 1 }; template< typename Real, typename Index > static bool setupMatrix( const MeshType& mesh, @@ -52,7 +52,7 @@ class MultidiagonalMatrixSetter< Meshes::Grid< 2, MeshReal, Device, MeshIndex > typedef MeshIndex MeshIndexType; typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; - enum { Dimensions = 2 }; + enum { Dimension = 2 }; template< typename Real, typename Index > static bool setupMatrix( const MeshType& mesh, @@ -72,7 +72,7 @@ class MultidiagonalMatrixSetter< Meshes::Grid< 3, MeshReal, Device, MeshIndex > typedef MeshIndex MeshIndexType; typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; - enum { Dimensions = 3 }; + enum { Dimension = 3 }; template< typename Real, typename Index > static bool setupMatrix( const MeshType& mesh, diff --git a/src/TNL/Matrices/Multidiagonal_impl.h b/src/TNL/Matrices/Multidiagonal_impl.h index 0e2aed933a19a0cf6e539e8179ac9544be4fa2ab..9545a2070c66b7c27a7cf2cb2e7a2e716bc74d64 100644 --- a/src/TNL/Matrices/Multidiagonal_impl.h +++ b/src/TNL/Matrices/Multidiagonal_impl.h @@ -70,7 +70,7 @@ bool Multidiagonal< Real, Device, Index >::setDimensions( const IndexType rows, template< typename Real, typename Device, typename Index > -bool Multidiagonal< Real, Device, Index >::setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) +bool Multidiagonal< Real, Device, Index >::setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) { /**** * TODO: implement some check here similar to the one in the tridiagonal matrix diff --git a/src/TNL/Matrices/SlicedEllpack.h b/src/TNL/Matrices/SlicedEllpack.h index cb1395a089cd412ec63bb945366ed1ba8fb857c6..ebae0c936e4a8b95beecc503e771ce1ed5d0b666 100644 --- a/src/TNL/Matrices/SlicedEllpack.h +++ b/src/TNL/Matrices/SlicedEllpack.h @@ -41,7 +41,7 @@ template< typename Real, typename Index, int SliceSize > __global__ void SlicedEllpack_computeMaximalRowLengthInSlices_CudaKernel( SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >* matrix, - const typename SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >::CompressedRowsLengthsVector* rowLengths, + const typename SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >::CompressedRowLengthsVector* rowLengths, int gridIdx ); #endif @@ -56,7 +56,7 @@ class SlicedEllpack : public Sparse< Real, Device, Index > typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename Sparse< RealType, DeviceType, IndexType >::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Sparse< RealType, DeviceType, IndexType >::CompressedRowLengthsVector CompressedRowLengthsVector; typedef typename Sparse< RealType, DeviceType, IndexType >::ValuesVector ValuesVector; typedef typename Sparse< RealType, DeviceType, IndexType >::ColumnIndexesVector ColumnIndexesVector; typedef SlicedEllpack< Real, Device, Index > ThisType; @@ -76,7 +76,7 @@ class SlicedEllpack : public Sparse< Real, Device, Index > bool setDimensions( const IndexType rows, const IndexType columns ); - bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ); + bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); IndexType getRowLength( const IndexType row ) const; @@ -190,19 +190,19 @@ class SlicedEllpack : public Sparse< Real, Device, Index > protected: - Containers::Vector< Index, Device, Index > slicePointers, sliceCompressedRowsLengths; + Containers::Vector< Index, Device, Index > slicePointers, sliceCompressedRowLengths; typedef SlicedEllpackDeviceDependentCode< DeviceType > DeviceDependentCode; friend class SlicedEllpackDeviceDependentCode< DeviceType >; #ifdef HAVE_CUDA /*friend __global__ void SlicedEllpack_computeMaximalRowLengthInSlices_CudaKernel< Real, Index, SliceSize >( SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >* matrix, - const typename SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >::CompressedRowsLengthsVector* rowLengths, + const typename SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >::CompressedRowLengthsVector* rowLengths, int gridIdx ); */ // TODO: The friend declaration above does not work because of __global__ storage specifier. Therefore we declare the following method as public. Fix this, when possible. public: - __device__ void computeMaximalRowLengthInSlicesCuda( const CompressedRowsLengthsVector& rowLengths, + __device__ void computeMaximalRowLengthInSlicesCuda( const CompressedRowLengthsVector& rowLengths, const IndexType sliceIdx ); #endif diff --git a/src/TNL/Matrices/SlicedEllpack_impl.h b/src/TNL/Matrices/SlicedEllpack_impl.h index d80d9f47982068b39fd1305435bd3714637d3cdc..097f1b6772ceb4035ceba25732872de122377051 100644 --- a/src/TNL/Matrices/SlicedEllpack_impl.h +++ b/src/TNL/Matrices/SlicedEllpack_impl.h @@ -64,12 +64,12 @@ template< typename Real, typename Device, typename Index, int SliceSize > -bool SlicedEllpack< Real, Device, Index, SliceSize >::setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) +bool SlicedEllpack< Real, Device, Index, SliceSize >::setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) { TNL_ASSERT( this->getRows() > 0, ); TNL_ASSERT( this->getColumns() > 0, ); const IndexType slices = roundUpDivision( this->rows, SliceSize ); - if( ! this->sliceCompressedRowsLengths.setSize( slices ) || + if( ! this->sliceCompressedRowLengths.setSize( slices ) || ! this->slicePointers.setSize( slices + 1 ) ) return false; @@ -88,7 +88,7 @@ template< typename Real, Index SlicedEllpack< Real, Device, Index, SliceSize >::getRowLength( const IndexType row ) const { const IndexType slice = row / SliceSize; - return this->sliceCompressedRowsLengths.getElement( slice ); + return this->sliceCompressedRowLengths.getElement( slice ); } template< typename Real, @@ -102,7 +102,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize >::setLike( const SlicedEllpa { if( !Sparse< Real, Device, Index >::setLike( matrix ) || ! this->slicePointers.setLike( matrix.slicePointers ) || - ! this->sliceCompressedRowsLengths.setLike( matrix.sliceCompressedRowsLengths ) ) + ! this->sliceCompressedRowLengths.setLike( matrix.sliceCompressedRowLengths ) ) return false; return true; } @@ -115,7 +115,7 @@ void SlicedEllpack< Real, Device, Index, SliceSize >::reset() { Sparse< Real, Device, Index >::reset(); this->slicePointers.reset(); - this->sliceCompressedRowsLengths.reset(); + this->sliceCompressedRowLengths.reset(); } template< typename Real, @@ -281,7 +281,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize > :: setRowFast( const IndexT const IndexType elements ) { const IndexType sliceIdx = row / SliceSize; - const IndexType rowLength = this->sliceCompressedRowsLengths[ sliceIdx ]; + const IndexType rowLength = this->sliceCompressedRowLengths[ sliceIdx ]; if( elements > rowLength ) return false; @@ -315,7 +315,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize > :: setRow( const IndexType const IndexType elements ) { const IndexType sliceIdx = row / SliceSize; - const IndexType rowLength = this->sliceCompressedRowsLengths.getElement( sliceIdx ); + const IndexType rowLength = this->sliceCompressedRowLengths.getElement( sliceIdx ); if( elements > rowLength ) return false; @@ -445,7 +445,7 @@ getRow( const IndexType rowIndex ) const IndexType slice = rowIndex / SliceSize; return MatrixRow( &this->columnIndexes[ rowBegin ], &this->values[ rowBegin ], - this->sliceCompressedRowsLengths[ slice ], + this->sliceCompressedRowLengths[ slice ], step ); } @@ -463,7 +463,7 @@ getRow( const IndexType rowIndex ) const const IndexType slice = rowIndex / SliceSize; return ConstMatrixRow( &this->columnIndexes[ rowBegin ], &this->values[ rowBegin ], - this->sliceCompressedRowsLengths[ slice ], + this->sliceCompressedRowLengths[ slice ], step ); } @@ -548,7 +548,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize >::performSORIteration( const RealType sum( 0.0 ); /*const IndexType sliceIdx = row / SliceSize; - const IndexType rowLength = this->sliceCompressedRowsLengths[ sliceIdx ]; + const IndexType rowLength = this->sliceCompressedRowLengths[ sliceIdx ]; IndexType elementPtr = this->slicePointers[ sliceIdx ] + rowLength * ( row - sliceIdx * SliceSize ); const IndexType rowEnd( elementPtr + rowLength );*/ @@ -581,7 +581,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize >::save( File& file ) const { if( ! Sparse< Real, Device, Index >::save( file ) || ! this->slicePointers.save( file ) || - ! this->sliceCompressedRowsLengths.save( file ) ) + ! this->sliceCompressedRowLengths.save( file ) ) return false; return true; } @@ -594,7 +594,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize >::load( File& file ) { if( ! Sparse< Real, Device, Index >::load( file ) || ! this->slicePointers.load( file ) || - ! this->sliceCompressedRowsLengths.load( file ) ) + ! this->sliceCompressedRowLengths.load( file ) ) return false; return true; } @@ -627,7 +627,7 @@ void SlicedEllpack< Real, Device, Index, SliceSize >::print( std::ostream& str ) { str <<"Row: " << row << " -> "; const IndexType sliceIdx = row / SliceSize; - const IndexType rowLength = this->sliceCompressedRowsLengths.getElement( sliceIdx ); + const IndexType rowLength = this->sliceCompressedRowLengths.getElement( sliceIdx ); IndexType elementPtr = this->slicePointers.getElement( sliceIdx ) + rowLength * ( row - sliceIdx * SliceSize ); const IndexType rowEnd( elementPtr + rowLength ); @@ -648,7 +648,7 @@ template< typename Real, typename Device, typename Index, int SliceSize > -__device__ void SlicedEllpack< Real, Device, Index, SliceSize >::computeMaximalRowLengthInSlicesCuda( const CompressedRowsLengthsVector& rowLengths, +__device__ void SlicedEllpack< Real, Device, Index, SliceSize >::computeMaximalRowLengthInSlicesCuda( const CompressedRowLengthsVector& rowLengths, const IndexType sliceIdx ) { Index rowIdx = sliceIdx * SliceSize; @@ -662,7 +662,7 @@ __device__ void SlicedEllpack< Real, Device, Index, SliceSize >::computeMaximalR rowIdx++; rowInSliceIdx++; } - this->sliceCompressedRowsLengths[ sliceIdx ] = maxRowLength; + this->sliceCompressedRowLengths[ sliceIdx ] = maxRowLength; this->slicePointers[ sliceIdx ] = maxRowLength * SliceSize; if( threadIdx.x == 0 ) this->slicePointers[ this->slicePointers.getSize() - 1 ] = 0; @@ -688,7 +688,7 @@ class SlicedEllpackDeviceDependentCode< Devices::Host > { const Index sliceIdx = row / SliceSize; const Index slicePointer = matrix.slicePointers.getElement( sliceIdx ); - const Index rowLength = matrix.sliceCompressedRowsLengths.getElement( sliceIdx ); + const Index rowLength = matrix.sliceCompressedRowLengths.getElement( sliceIdx ); rowBegin = slicePointer + rowLength * ( row - sliceIdx * SliceSize ); rowEnd = rowBegin + rowLength; @@ -707,7 +707,7 @@ class SlicedEllpackDeviceDependentCode< Devices::Host > { const Index sliceIdx = row / SliceSize; const Index slicePointer = matrix.slicePointers[ sliceIdx ]; - const Index rowLength = matrix.sliceCompressedRowsLengths[ sliceIdx ]; + const Index rowLength = matrix.sliceCompressedRowLengths[ sliceIdx ]; rowBegin = slicePointer + rowLength * ( row - sliceIdx * SliceSize ); rowEnd = rowBegin + rowLength; @@ -719,7 +719,7 @@ class SlicedEllpackDeviceDependentCode< Devices::Host > typename Index, int SliceSize > static bool computeMaximalRowLengthInSlices( SlicedEllpack< Real, Device, Index, SliceSize >& matrix, - const typename SlicedEllpack< Real, Device, Index >::CompressedRowsLengthsVector& rowLengths ) + const typename SlicedEllpack< Real, Device, Index >::CompressedRowLengthsVector& rowLengths ) { Index row( 0 ), slice( 0 ), sliceRowLength( 0 ); while( row < matrix.getRows() ) @@ -727,14 +727,14 @@ class SlicedEllpackDeviceDependentCode< Devices::Host > sliceRowLength = max( rowLengths.getElement( row++ ), sliceRowLength ); if( row % SliceSize == 0 ) { - matrix.sliceCompressedRowsLengths.setElement( slice, sliceRowLength ); + matrix.sliceCompressedRowLengths.setElement( slice, sliceRowLength ); matrix.slicePointers.setElement( slice++, sliceRowLength * SliceSize ); sliceRowLength = 0; } } if( row % SliceSize != 0 ) { - matrix.sliceCompressedRowsLengths.setElement( slice, sliceRowLength ); + matrix.sliceCompressedRowLengths.setElement( slice, sliceRowLength ); matrix.slicePointers.setElement( slice++, sliceRowLength * SliceSize ); } matrix.slicePointers.setElement( matrix.slicePointers.getSize() - 1, 0 ); @@ -764,7 +764,7 @@ template< typename Real, typename Index, int SliceSize > __global__ void SlicedEllpack_computeMaximalRowLengthInSlices_CudaKernel( SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >* matrix, - const typename SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >::CompressedRowsLengthsVector* rowLengths, + const typename SlicedEllpack< Real, Devices::Cuda, Index, SliceSize >::CompressedRowLengthsVector* rowLengths, int gridIdx ) { const Index sliceIdx = gridIdx * Devices::Cuda::getMaxGridSize() * blockDim.x + blockIdx.x * blockDim.x + threadIdx.x; @@ -781,7 +781,7 @@ __global__ void SlicedEllpackVectorProductCudaKernel( const Index rows, const Index columns, const Index* slicePointers, - const Index* sliceCompressedRowsLengths, + const Index* sliceCompressedRowLengths, const Index paddingIndex, const Index* columnIndexes, const Real* values, @@ -794,7 +794,7 @@ __global__ void SlicedEllpackVectorProductCudaKernel( return; const Index sliceIdx = rowIdx / SliceSize; const Index slicePointer = slicePointers[ sliceIdx ]; - const Index rowLength = sliceCompressedRowsLengths[ sliceIdx ]; + const Index rowLength = sliceCompressedRowLengths[ sliceIdx ]; Index i = slicePointer + rowIdx - sliceIdx * SliceSize; const Index rowEnd = i + rowLength * SliceSize; Real result( 0.0 ); @@ -829,7 +829,7 @@ class SlicedEllpackDeviceDependentCode< Devices::Cuda > { const Index sliceIdx = row / SliceSize; const Index slicePointer = matrix.slicePointers.getElement( sliceIdx ); - const Index rowLength = matrix.sliceCompressedRowsLengths.getElement( sliceIdx ); + const Index rowLength = matrix.sliceCompressedRowLengths.getElement( sliceIdx ); rowBegin = slicePointer + row - sliceIdx * SliceSize; rowEnd = rowBegin + rowLength * SliceSize; @@ -848,7 +848,7 @@ class SlicedEllpackDeviceDependentCode< Devices::Cuda > { const Index sliceIdx = row / SliceSize; const Index slicePointer = matrix.slicePointers[ sliceIdx ]; - const Index rowLength = matrix.sliceCompressedRowsLengths[ sliceIdx ]; + const Index rowLength = matrix.sliceCompressedRowLengths[ sliceIdx ]; rowBegin = slicePointer + row - sliceIdx * SliceSize; rowEnd = rowBegin + rowLength * SliceSize; @@ -860,13 +860,13 @@ class SlicedEllpackDeviceDependentCode< Devices::Cuda > typename Index, int SliceSize > static bool computeMaximalRowLengthInSlices( SlicedEllpack< Real, Device, Index, SliceSize >& matrix, - const typename SlicedEllpack< Real, Device, Index >::CompressedRowsLengthsVector& rowLengths ) + const typename SlicedEllpack< Real, Device, Index >::CompressedRowLengthsVector& rowLengths ) { #ifdef HAVE_CUDA typedef SlicedEllpack< Real, Device, Index, SliceSize > Matrix; - typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Matrix::CompressedRowLengthsVector CompressedRowLengthsVector; Matrix* kernel_matrix = Devices::Cuda::passToDevice( matrix ); - CompressedRowsLengthsVector* kernel_rowLengths = Devices::Cuda::passToDevice( rowLengths ); + CompressedRowLengthsVector* kernel_rowLengths = Devices::Cuda::passToDevice( rowLengths ); const Index numberOfSlices = roundUpDivision( matrix.getRows(), SliceSize ); dim3 cudaBlockSize( 256 ), cudaGridSize( Devices::Cuda::getMaxGridSize() ); const Index cudaBlocks = roundUpDivision( numberOfSlices, cudaBlockSize.x ); @@ -916,7 +916,7 @@ class SlicedEllpackDeviceDependentCode< Devices::Cuda > ( matrix.getRows(), matrix.getColumns(), matrix.slicePointers.getData(), - matrix.sliceCompressedRowsLengths.getData(), + matrix.sliceCompressedRowLengths.getData(), matrix.getPaddingIndex(), matrix.columnIndexes.getData(), matrix.values.getData(), diff --git a/src/TNL/Matrices/Sparse.h b/src/TNL/Matrices/Sparse.h index 27a021f038eab6553924792aec2739d080253960..c1f6e168ed8dcf7d3be44cea43bbdc3dc4ff707f 100644 --- a/src/TNL/Matrices/Sparse.h +++ b/src/TNL/Matrices/Sparse.h @@ -26,7 +26,7 @@ class Sparse : public Matrix< Real, Device, Index > typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename Matrix< RealType, DeviceType, IndexType >::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Matrix< RealType, DeviceType, IndexType >::CompressedRowLengthsVector CompressedRowLengthsVector; typedef typename Matrix< RealType, DeviceType, IndexType >::ValuesVector ValuesVector; typedef Containers::Vector< IndexType, DeviceType, IndexType > ColumnIndexesVector; typedef Matrix< Real, Device, Index > BaseType; @@ -34,7 +34,7 @@ class Sparse : public Matrix< Real, Device, Index > Sparse(); - virtual bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) = 0; + virtual bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) = 0; template< typename Real2, typename Device2, typename Index2 > bool setLike( const Sparse< Real2, Device2, Index2 >& matrix ); diff --git a/src/TNL/Matrices/Tridiagonal.h b/src/TNL/Matrices/Tridiagonal.h index 5457f12f18053bc869640966958d703c31f99a4c..88c9cc9164d8bff79a1cef9b304b368e6ac3c606 100644 --- a/src/TNL/Matrices/Tridiagonal.h +++ b/src/TNL/Matrices/Tridiagonal.h @@ -30,7 +30,7 @@ class Tridiagonal : public Matrix< Real, Device, Index > typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename Matrix< Real, Device, Index >::CompressedRowsLengthsVector CompressedRowsLengthsVector; + typedef typename Matrix< Real, Device, Index >::CompressedRowLengthsVector CompressedRowLengthsVector; typedef Tridiagonal< Real, Device, Index > ThisType; typedef Tridiagonal< Real, Devices::Host, Index > HostType; typedef Tridiagonal< Real, Devices::Cuda, Index > CudaType; @@ -46,7 +46,7 @@ class Tridiagonal : public Matrix< Real, Device, Index > bool setDimensions( const IndexType rows, const IndexType columns ); - bool setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ); + bool setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); IndexType getRowLength( const IndexType row ) const; diff --git a/src/TNL/Matrices/Tridiagonal_impl.h b/src/TNL/Matrices/Tridiagonal_impl.h index 7876f07cb7e816817f6ca59aadebd32afb9874be..9d15ba841de1a7d64d284aa4e6301d8b9e6f6e48 100644 --- a/src/TNL/Matrices/Tridiagonal_impl.h +++ b/src/TNL/Matrices/Tridiagonal_impl.h @@ -62,7 +62,7 @@ bool Tridiagonal< Real, Device, Index >::setDimensions( const IndexType rows, template< typename Real, typename Device, typename Index > -bool Tridiagonal< Real, Device, Index >::setCompressedRowsLengths( const CompressedRowsLengthsVector& rowLengths ) +bool Tridiagonal< Real, Device, Index >::setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) { if( rowLengths[ 0 ] > 2 ) return false; diff --git a/src/TNL/Meshes/CMakeLists.txt b/src/TNL/Meshes/CMakeLists.txt index b97985a544941ef4a3107ba38a8cd4e1259d414a..b06294793cbe0f662d9c07e2002930e1cdc03fdc 100755 --- a/src/TNL/Meshes/CMakeLists.txt +++ b/src/TNL/Meshes/CMakeLists.txt @@ -6,7 +6,7 @@ SET( headers Grid.h GridEntity.h GridEntityConfig.h DummyMesh.h - MeshDimensionsTag.h + MeshDimensionTag.h Mesh.h MeshEntity.h Traverser.h diff --git a/src/TNL/Meshes/DummyMesh.h b/src/TNL/Meshes/DummyMesh.h index 3b57ed34905a8929c3a52c7246c29eb490bff9f0..efbf1be40615463610df3a4ceec361b634884582 100644 --- a/src/TNL/Meshes/DummyMesh.h +++ b/src/TNL/Meshes/DummyMesh.h @@ -25,9 +25,9 @@ class DummyMesh typedef Index IndexType; typedef DummyMesh< Real, Device, Index > ThisType; - static const int meshDimensions = 1; + static const int meshDimension = 1; - constexpr static int getMeshDimensions() { return meshDimensions; } + constexpr static int getMeshDimension() { return meshDimension; } const Real& getParametricStep(){ return 0.0; } diff --git a/src/TNL/Meshes/Grid.h b/src/TNL/Meshes/Grid.h index d5966b033e582c32633d03c4aa0a4a05ae870155..07053991262385c8fd19e72377693c6748fc84de 100644 --- a/src/TNL/Meshes/Grid.h +++ b/src/TNL/Meshes/Grid.h @@ -18,7 +18,7 @@ namespace TNL { namespace Meshes { -template< int Dimensions, +template< int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int > diff --git a/src/TNL/Meshes/GridDetails/CMakeLists.txt b/src/TNL/Meshes/GridDetails/CMakeLists.txt index 7e39623121c8dba1ee95332a69fada92a561bbd5..eeecd7bc50bbbac8492066be8f7bf9bf20b19e4d 100644 --- a/src/TNL/Meshes/GridDetails/CMakeLists.txt +++ b/src/TNL/Meshes/GridDetails/CMakeLists.txt @@ -15,11 +15,11 @@ SET( headers BoundaryGridEntityChecker.h GridEntityTopology.h GridTraverser.h GridTraverser_impl.h - NeighbourGridEntitiesStorage.h - NeighbourGridEntityGetter1D_impl.h - NeighbourGridEntityGetter2D_impl.h - NeighbourGridEntityGetter3D_impl.h - NeighbourGridEntityGetter.h + NeighborGridEntitiesStorage.h + NeighborGridEntityGetter1D_impl.h + NeighborGridEntityGetter2D_impl.h + NeighborGridEntityGetter3D_impl.h + NeighborGridEntityGetter.h Traverser_Grid1D.h Traverser_Grid1D_impl.h Traverser_Grid2D.h diff --git a/src/TNL/Meshes/GridDetails/Grid1D.h b/src/TNL/Meshes/GridDetails/Grid1D.h index d2a96c4ad5bae4bf19374c90a60cfbd5d146b100..51b082a66f3deef4d444099e64a62cc6388c0685 100644 --- a/src/TNL/Meshes/GridDetails/Grid1D.h +++ b/src/TNL/Meshes/GridDetails/Grid1D.h @@ -14,7 +14,7 @@ #include <TNL/Logger.h> #include <TNL/Meshes/GridDetails/GridEntityTopology.h> #include <TNL/Meshes/GridDetails/GridEntityGetter.h> -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter.h> #include <TNL/Meshes/GridEntity.h> #include <TNL/Meshes/GridEntityConfig.h> @@ -31,23 +31,23 @@ class Grid< 1, Real, Device, Index > : public Object typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef Containers::StaticVector< 1, Real > VertexType; + typedef Containers::StaticVector< 1, Real > PointType; typedef Containers::StaticVector< 1, Index > CoordinatesType; typedef Grid< 1, Real, Devices::Host, Index > HostType; typedef Grid< 1, Real, Devices::Cuda, Index > CudaType; typedef Grid< 1, Real, Device, Index > ThisType; - static const int meshDimensions = 1; + static const int meshDimension = 1; - template< int EntityDimensions, + template< int EntityDimension, typename Config = GridEntityCrossStencilStorage< 1 > > - using MeshEntity = GridEntity< ThisType, EntityDimensions, Config >; + using MeshEntity = GridEntity< ThisType, EntityDimension, Config >; - typedef MeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > Cell; + typedef MeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > Cell; typedef MeshEntity< 0 > Face; typedef MeshEntity< 0 > Vertex; - static constexpr int getMeshDimensions() { return meshDimensions; }; + static constexpr int getMeshDimension() { return meshDimension; }; Grid(); @@ -66,14 +66,14 @@ class Grid< 1, Real, Device, Index > : public Object __cuda_callable__ inline const CoordinatesType& getDimensions() const; - void setDomain( const VertexType& origin, - const VertexType& proportions ); + void setDomain( const PointType& origin, + const PointType& proportions ); __cuda_callable__ - inline const VertexType& getOrigin() const; + inline const PointType& getOrigin() const; __cuda_callable__ - inline const VertexType& getProportions() const; + inline const PointType& getProportions() const; template< typename EntityType > __cuda_callable__ @@ -95,7 +95,7 @@ class Grid< 1, Real, Device, Index > : public Object inline const RealType& getCellMeasure() const; __cuda_callable__ - inline const VertexType& getSpaceSteps() const; + inline const PointType& getSpaceSteps() const; template< int xPow > __cuda_callable__ @@ -146,9 +146,9 @@ class Grid< 1, Real, Device, Index > : public Object IndexType numberOfCells, numberOfVertices; - VertexType origin, proportions; + PointType origin, proportions; - VertexType spaceSteps; + PointType spaceSteps; RealType spaceStepsProducts[ 5 ]; }; diff --git a/src/TNL/Meshes/GridDetails/Grid1D_impl.h b/src/TNL/Meshes/GridDetails/Grid1D_impl.h index cac0ad3da8884483d4f48e91b62baba5b30b0dda..b985708db5e9f653feb65f990cc3143f88dffa1b 100644 --- a/src/TNL/Meshes/GridDetails/Grid1D_impl.h +++ b/src/TNL/Meshes/GridDetails/Grid1D_impl.h @@ -16,7 +16,7 @@ #include <TNL/Assert.h> #include <TNL/Meshes/GridDetails/GnuplotWriter.h> #include <TNL/Meshes/GridDetails/GridEntityGetter_impl.h> -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter1D_impl.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h> #include <TNL/Meshes/GridDetails/Grid1D.h> #include <TNL/Meshes/GridDetails/GridEntityMeasureGetter.h> @@ -38,7 +38,7 @@ template< typename Real, String Grid< 1, Real, Device, Index >::getType() { return String( "Meshes::Grid< " ) + - String( getMeshDimensions() ) + ", " + + String( getMeshDimension() ) + ", " + String( TNL::getType< RealType >() ) + ", " + String( Device::getDeviceType() ) + ", " + String( TNL::getType< IndexType >() ) + " >"; @@ -118,8 +118,8 @@ const typename Grid< 1, Real, Device, Index >::CoordinatesType& template< typename Real, typename Device, typename Index > -void Grid< 1, Real, Device, Index >::setDomain( const VertexType& origin, - const VertexType& proportions ) +void Grid< 1, Real, Device, Index >::setDomain( const PointType& origin, + const PointType& proportions ) { this->origin = origin; this->proportions = proportions; @@ -130,7 +130,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 1, Real, Device, Index >::VertexType& +const typename Grid< 1, Real, Device, Index >::PointType& Grid< 1, Real, Device, Index >::getOrigin() const { return this->origin; @@ -140,7 +140,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 1, Real, Device, Index >::VertexType& +const typename Grid< 1, Real, Device, Index >::PointType& Grid< 1, Real, Device, Index >::getProportions() const { return this->proportions; @@ -155,10 +155,10 @@ Index Grid< 1, Real, Device, Index >:: getEntitiesCount() const { - static_assert( EntityType::entityDimensions <= 1 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 1 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); - switch( EntityType::entityDimensions ) + switch( EntityType::entityDimension ) { case 1: return this->numberOfCells; @@ -177,8 +177,8 @@ EntityType Grid< 1, Real, Device, Index >:: getEntity( const IndexType& entityIndex ) const { - static_assert( EntityType::entityDimensions <= 1 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 1 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex ); } @@ -192,8 +192,8 @@ Index Grid< 1, Real, Device, Index >:: getEntityIndex( const EntityType& entity ) const { - static_assert( EntityType::entityDimensions <= 1 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 1 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity ); } @@ -225,7 +225,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 1, Real, Device, Index >::VertexType& +const typename Grid< 1, Real, Device, Index >::PointType& Grid< 1, Real, Device, Index >:: getSpaceSteps() const { @@ -391,12 +391,12 @@ bool Grid< 1, Real, Device, Index >::write( const MeshFunction& function, const RealType hx = getSpaceSteps(). x(); if( format == "gnuplot" ) { - typename ThisType::template MeshEntity< getMeshDimensions() > entity( *this ); + typename ThisType::template MeshEntity< getMeshDimension() > entity( *this ); for( entity.getCoordinates().x() = 0; entity.getCoordinates().x() < getDimensions(). x(); entity.getCoordinates().x() ++ ) { - VertexType v = entity.getCenter(); + PointType v = entity.getCenter(); GnuplotWriter::write( file, v ); GnuplotWriter::write( file, function[ this->getEntityIndex( entity ) ] ); file << std::endl; @@ -413,7 +413,7 @@ void Grid< 1, Real, Device, Index >:: writeProlog( Logger& logger ) { - logger.writeParameter( "Dimensions:", getMeshDimensions() ); + logger.writeParameter( "Dimension:", getMeshDimension() ); logger.writeParameter( "Domain origin:", this->origin ); logger.writeParameter( "Domain proportions:", this->proportions ); logger.writeParameter( "Domain dimensions:", this->dimensions ); diff --git a/src/TNL/Meshes/GridDetails/Grid2D.h b/src/TNL/Meshes/GridDetails/Grid2D.h index 6c7dfca7f61089f61c8ec2d9e5d4be995f3c9906..941616248461dc0930a9debf3b7d6e3912e7b157 100644 --- a/src/TNL/Meshes/GridDetails/Grid2D.h +++ b/src/TNL/Meshes/GridDetails/Grid2D.h @@ -13,7 +13,7 @@ #include <TNL/Meshes/Grid.h> #include <TNL/Meshes/GridDetails/GridEntityTopology.h> #include <TNL/Meshes/GridDetails/GridEntityGetter.h> -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter.h> namespace TNL { namespace Meshes { @@ -28,31 +28,31 @@ class Grid< 2, Real, Device, Index > : public Object typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef Containers::StaticVector< 2, Real > VertexType; + typedef Containers::StaticVector< 2, Real > PointType; typedef Containers::StaticVector< 2, Index > CoordinatesType; typedef Grid< 2, Real, Devices::Host, Index > HostType; typedef Grid< 2, Real, Devices::Cuda, Index > CudaType; typedef Grid< 2, Real, Device, Index > ThisType; - static const int meshDimensions = 2; + static const int meshDimension = 2; - template< int EntityDimensions, + template< int EntityDimension, typename Config = GridEntityNoStencilStorage >//CrossStencilStorage< 1 > > - using MeshEntity = GridEntity< ThisType, EntityDimensions, Config >; + using MeshEntity = GridEntity< ThisType, EntityDimension, Config >; - typedef MeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > Cell; - typedef MeshEntity< meshDimensions - 1, GridEntityNoStencilStorage > Face; + typedef MeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > Cell; + typedef MeshEntity< meshDimension - 1, GridEntityNoStencilStorage > Face; typedef MeshEntity< 0 > Vertex; // TODO: remove this - //template< int EntityDimensions, + //template< int EntityDimension, // typename Config = GridEntityNoStencilStorage >//CrossStencilStorage< 1 > > - //using TestMeshEntity = tnlTestGridEntity< ThisType, EntityDimensions, Config >; - //typedef TestMeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > TestCell; + //using TestMeshEntity = tnlTestGridEntity< ThisType, EntityDimension, Config >; + //typedef TestMeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > TestCell; ///// - static constexpr int getMeshDimensions() { return meshDimensions; }; + static constexpr int getMeshDimension() { return meshDimension; }; Grid(); @@ -71,13 +71,13 @@ class Grid< 2, Real, Device, Index > : public Object __cuda_callable__ inline const CoordinatesType& getDimensions() const; - void setDomain( const VertexType& origin, - const VertexType& proportions ); + void setDomain( const PointType& origin, + const PointType& proportions ); __cuda_callable__ - inline const VertexType& getOrigin() const; + inline const PointType& getOrigin() const; __cuda_callable__ - inline const VertexType& getProportions() const; + inline const PointType& getProportions() const; template< typename EntityType > __cuda_callable__ @@ -99,7 +99,7 @@ class Grid< 2, Real, Device, Index > : public Object inline const RealType& getCellMeasure() const; __cuda_callable__ - inline const VertexType& getSpaceSteps() const; + inline const PointType& getSpaceSteps() const; template< int xPow, int yPow > __cuda_callable__ @@ -154,9 +154,9 @@ class Grid< 2, Real, Device, Index > : public Object IndexType numberOfCells, numberOfNxFaces, numberOfNyFaces, numberOfFaces, numberOfVertices; - VertexType origin, proportions; + PointType origin, proportions; - VertexType spaceSteps; + PointType spaceSteps; RealType spaceStepsProducts[ 5 ][ 5 ]; diff --git a/src/TNL/Meshes/GridDetails/Grid2D_impl.h b/src/TNL/Meshes/GridDetails/Grid2D_impl.h index 4d0d87fb2f1d7f752c6330c94c90137b7cb3830d..90cfdad79bcdfe976c5b86021e081ce7637fa836 100644 --- a/src/TNL/Meshes/GridDetails/Grid2D_impl.h +++ b/src/TNL/Meshes/GridDetails/Grid2D_impl.h @@ -15,7 +15,7 @@ #include <TNL/Assert.h> #include <TNL/Meshes/GridDetails/GnuplotWriter.h> #include <TNL/Meshes/GridDetails/GridEntityGetter_impl.h> -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter2D_impl.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h> #include <TNL/Meshes/GridDetails/GridEntityMeasureGetter.h> namespace TNL { @@ -39,7 +39,7 @@ template< typename Real, String Grid< 2, Real, Device, Index > :: getType() { return String( "Meshes::Grid< " ) + - String( getMeshDimensions() ) + ", " + + String( getMeshDimension() ) + ", " + String( TNL::getType< RealType >() ) + ", " + String( Device :: getDeviceType() ) + ", " + String( TNL::getType< IndexType >() ) + " >"; @@ -168,8 +168,8 @@ Grid< 2, Real, Device, Index > :: getDimensions() const template< typename Real, typename Device, typename Index > -void Grid< 2, Real, Device, Index > :: setDomain( const VertexType& origin, - const VertexType& proportions ) +void Grid< 2, Real, Device, Index > :: setDomain( const PointType& origin, + const PointType& proportions ) { this->origin = origin; this->proportions = proportions; @@ -180,7 +180,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 2, Real, Device, Index >::VertexType& +const typename Grid< 2, Real, Device, Index >::PointType& Grid< 2, Real, Device, Index >::getOrigin() const { return this->origin; @@ -190,7 +190,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 2, Real, Device, Index > :: VertexType& +const typename Grid< 2, Real, Device, Index > :: PointType& Grid< 2, Real, Device, Index > :: getProportions() const { return this->proportions; @@ -205,10 +205,10 @@ Index Grid< 2, Real, Device, Index >:: getEntitiesCount() const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); - switch( EntityType::entityDimensions ) + switch( EntityType::entityDimension ) { case 2: return this->numberOfCells; @@ -229,8 +229,8 @@ EntityType Grid< 2, Real, Device, Index >:: getEntity( const IndexType& entityIndex ) const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex ); } @@ -244,8 +244,8 @@ Index Grid< 2, Real, Device, Index >:: getEntityIndex( const EntityType& entity ) const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity ); } @@ -278,7 +278,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 2, Real, Device, Index >::VertexType& +const typename Grid< 2, Real, Device, Index >::PointType& Grid< 2, Real, Device, Index >:: getSpaceSteps() const { @@ -454,7 +454,7 @@ bool Grid< 2, Real, Device, Index > :: writeMesh( const String& fileName, << std::endl << std::endl; MeshEntity< 0 > vertex( *this ); CoordinatesType& vertexCoordinates = vertex.getCoordinates(); - VertexType v; + PointType v; for( Index j = 0; j < this->dimensions. y(); j ++ ) { file << "draw( "; @@ -506,13 +506,13 @@ bool Grid< 2, Real, Device, Index > :: writeMesh( const String& fileName, for( Index i = 0; i < this->dimensions. x(); i ++ ) for( Index j = 0; j < this->dimensions. y(); j ++ ) { - VertexType v1, v2, c; + PointType v1, v2, c; /**** * East edge normal */ - /*v1 = this->getVertex( CoordinatesType( i + 1, j ), v1 ); - v2 = this->getVertex( CoordinatesType( i + 1, j + 1 ), v2 ); + /*v1 = this->getPoint( CoordinatesType( i + 1, j ), v1 ); + v2 = this->getPoint( CoordinatesType( i + 1, j + 1 ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 1, 0 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -522,8 +522,8 @@ bool Grid< 2, Real, Device, Index > :: writeMesh( const String& fileName, /**** * West edge normal */ - /*this->getVertex< -1, -1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, 1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< -1, -1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, 1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< -1, 0 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -533,8 +533,8 @@ bool Grid< 2, Real, Device, Index > :: writeMesh( const String& fileName, /**** * North edge normal */ - /*this->getVertex< 1, 1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, 1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< 1, 1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, 1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 0, 1 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -544,8 +544,8 @@ bool Grid< 2, Real, Device, Index > :: writeMesh( const String& fileName, /**** * South edge normal */ - /*this->getVertex< 1, -1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, -1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< 1, -1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, -1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 0, -1 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -589,7 +589,7 @@ bool Grid< 2, Real, Device, Index > :: write( const MeshFunction& function, { for( cellCoordinates.x() = 0; cellCoordinates.x() < getDimensions(). x(); cellCoordinates.x() ++ ) { - VertexType v = cell.getCenter(); + PointType v = cell.getCenter(); GnuplotWriter::write( file, v ); GnuplotWriter::write( file, function[ this->getEntityIndex( cell ) ] ); file << std::endl; @@ -608,7 +608,7 @@ void Grid< 2, Real, Device, Index >:: writeProlog( Logger& logger ) { - logger.writeParameter( "Dimensions:", getMeshDimensions() ); + logger.writeParameter( "Dimension:", getMeshDimension() ); logger.writeParameter( "Domain origin:", this->origin ); logger.writeParameter( "Domain proportions:", this->proportions ); logger.writeParameter( "Domain dimensions:", this->dimensions ); diff --git a/src/TNL/Meshes/GridDetails/Grid3D.h b/src/TNL/Meshes/GridDetails/Grid3D.h index 860b5e473528cf0de601648a77bb0bd6f0aba490..4c732d5085221d838fb6ada80c49db2f958f3b40 100644 --- a/src/TNL/Meshes/GridDetails/Grid3D.h +++ b/src/TNL/Meshes/GridDetails/Grid3D.h @@ -13,7 +13,7 @@ #include <TNL/Meshes/Grid.h> #include <TNL/Meshes/GridDetails/GridEntityTopology.h> #include <TNL/Meshes/GridDetails/GridEntityGetter.h> -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter.h> namespace TNL { namespace Meshes { @@ -28,24 +28,24 @@ class Grid< 3, Real, Device, Index > : public Object typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef Containers::StaticVector< 3, Real > VertexType; + typedef Containers::StaticVector< 3, Real > PointType; typedef Containers::StaticVector< 3, Index > CoordinatesType; typedef Grid< 3, Real, Devices::Host, Index > HostType; typedef Grid< 3, Real, Devices::Cuda, Index > CudaType; typedef Grid< 3, Real, Device, Index > ThisType; - static const int meshDimensions = 3; + static const int meshDimension = 3; - template< int EntityDimensions, + template< int EntityDimension, typename Config = GridEntityCrossStencilStorage< 1 > > - using MeshEntity = GridEntity< ThisType, EntityDimensions, Config >; + using MeshEntity = GridEntity< ThisType, EntityDimension, Config >; - typedef MeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > Cell; - typedef MeshEntity< meshDimensions - 1 > Face; + typedef MeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > Cell; + typedef MeshEntity< meshDimension - 1 > Face; typedef MeshEntity< 1 > Edge; typedef MeshEntity< 0 > Vertex; - static constexpr int getMeshDimensions() { return meshDimensions; }; + static constexpr int getMeshDimension() { return meshDimension; }; Grid(); @@ -64,13 +64,13 @@ class Grid< 3, Real, Device, Index > : public Object __cuda_callable__ inline const CoordinatesType& getDimensions() const; - void setDomain( const VertexType& origin, - const VertexType& proportions ); + void setDomain( const PointType& origin, + const PointType& proportions ); __cuda_callable__ - inline const VertexType& getOrigin() const; + inline const PointType& getOrigin() const; __cuda_callable__ - inline const VertexType& getProportions() const; + inline const PointType& getProportions() const; template< typename EntityType > __cuda_callable__ @@ -92,7 +92,7 @@ class Grid< 3, Real, Device, Index > : public Object inline const RealType& getCellMeasure() const; __cuda_callable__ - inline const VertexType& getSpaceSteps() const; + inline const PointType& getSpaceSteps() const; template< int xPow, int yPow, int zPow > __cuda_callable__ @@ -149,11 +149,11 @@ class Grid< 3, Real, Device, Index > : public Object numberOfDxEdges, numberOfDyEdges, numberOfDzEdges, numberOfDxAndDyEdges, numberOfEdges, numberOfVertices; - VertexType origin, proportions; + PointType origin, proportions; - IndexType cellZNeighboursStep; + IndexType cellZNeighborsStep; - VertexType spaceSteps; + PointType spaceSteps; RealType spaceStepsProducts[ 5 ][ 5 ][ 5 ]; @@ -161,7 +161,7 @@ class Grid< 3, Real, Device, Index > : public Object friend class GridEntityGetter; template< typename, int, typename > - friend class NeighbourGridEntityGetter; + friend class NeighborGridEntityGetter; }; } // namespace Meshes diff --git a/src/TNL/Meshes/GridDetails/Grid3D_impl.h b/src/TNL/Meshes/GridDetails/Grid3D_impl.h index d9cdaa1dfe62359328f11c369cd16d0a43d168d5..935a2c198666fd6b581cd3c7b36bc165c3bde374 100644 --- a/src/TNL/Meshes/GridDetails/Grid3D_impl.h +++ b/src/TNL/Meshes/GridDetails/Grid3D_impl.h @@ -13,7 +13,7 @@ #include <iomanip> #include <TNL/Assert.h> #include <TNL/Meshes/GridDetails/GridEntityGetter_impl.h> -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter3D_impl.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h> #include <TNL/Meshes/GridDetails/Grid3D.h> #include <TNL/Meshes/GridDetails/GridEntityMeasureGetter.h> @@ -45,7 +45,7 @@ template< typename Real, String Grid< 3, Real, Device, Index > :: getType() { return String( "Meshes::Grid< " ) + - String( meshDimensions ) + ", " + + String( meshDimension ) + ", " + String( TNL::getType< RealType >() ) + ", " + String( Device :: getDeviceType() ) + ", " + String( TNL::getType< IndexType >() ) + " >"; @@ -188,7 +188,7 @@ void Grid< 3, Real, Device, Index > :: setDimensions( const Index xSize, const I this->numberOfDzEdges; this->numberOfVertices = ( xSize + 1 ) * ( ySize + 1 ) * ( zSize + 1 ); - this->cellZNeighboursStep = xSize * ySize; + this->cellZNeighborsStep = xSize * ySize; computeSpaceSteps(); } @@ -214,8 +214,8 @@ const typename Grid< 3, Real, Device, Index > :: CoordinatesType& template< typename Real, typename Device, typename Index > -void Grid< 3, Real, Device, Index > :: setDomain( const VertexType& origin, - const VertexType& proportions ) +void Grid< 3, Real, Device, Index > :: setDomain( const PointType& origin, + const PointType& proportions ) { this->origin = origin; this->proportions = proportions; @@ -226,7 +226,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 3, Real, Device, Index >::VertexType& +const typename Grid< 3, Real, Device, Index >::PointType& Grid< 3, Real, Device, Index >::getOrigin() const { return this->origin; @@ -236,7 +236,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 3, Real, Device, Index > :: VertexType& +const typename Grid< 3, Real, Device, Index > :: PointType& Grid< 3, Real, Device, Index > :: getProportions() const { return this->proportions; @@ -251,10 +251,10 @@ Index Grid< 3, Real, Device, Index >:: getEntitiesCount() const { - static_assert( EntityType::entityDimensions <= 3 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 3 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); - switch( EntityType::entityDimensions ) + switch( EntityType::entityDimension ) { case 3: return this->numberOfCells; @@ -277,8 +277,8 @@ EntityType Grid< 3, Real, Device, Index >:: getEntity( const IndexType& entityIndex ) const { - static_assert( EntityType::entityDimensions <= 3 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 3 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex ); } @@ -292,8 +292,8 @@ Index Grid< 3, Real, Device, Index >:: getEntityIndex( const EntityType& entity ) const { - static_assert( EntityType::entityDimensions <= 3 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 3 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity ); } @@ -325,7 +325,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Grid< 3, Real, Device, Index >::VertexType& +const typename Grid< 3, Real, Device, Index >::PointType& Grid< 3, Real, Device, Index >:: getSpaceSteps() const { @@ -379,7 +379,7 @@ typename GridFunction::RealType const typename GridFunction::RealType& p ) const { typename GridFunction::RealType lpNorm( 0.0 ); - MeshEntity< getMeshDimensions() > cell; + MeshEntity< getMeshDimension() > cell; for( cell.getCoordinates().z() = 0; cell.getCoordinates().z() < getDimensions().z(); cell.getCoordinates().z()++ ) @@ -407,7 +407,7 @@ template< typename Real, const GridFunction& f2 ) const { typename GridFunction::RealType maxDiff( -1.0 ); - MeshEntity< getMeshDimensions() > cell( *this ); + MeshEntity< getMeshDimension() > cell( *this ); for( cell.getCoordinates().z() = 0; cell.getCoordinates().z() < getDimensions().z(); cell.getCoordinates().z()++ ) @@ -434,7 +434,7 @@ template< typename Real, const typename GridFunction::RealType& p ) const { typename GridFunction::RealType lpNorm( 0.0 ); - MeshEntity< getMeshDimensions() > cell( *this ); + MeshEntity< getMeshDimension() > cell( *this ); for( cell.getCoordinates().z() = 0; cell.getCoordinates().z() < getDimensions().z(); @@ -552,7 +552,7 @@ bool Grid< 3, Real, Device, Index > :: write( const MeshFunction& function, cell.getCoordinates().x() < getDimensions().x(); cell.getCoordinates().x()++ ) { - VertexType v = cell.getCenter(); + PointType v = cell.getCenter(); GnuplotWriter::write( file, v ); GnuplotWriter::write( file, function[ this->template getEntityIndex( cell ) ] ); file << std::endl; @@ -573,7 +573,7 @@ void Grid< 3, Real, Device, Index >:: writeProlog( Logger& logger ) { - logger.writeParameter( "Dimensions:", getMeshDimensions() ); + logger.writeParameter( "Dimension:", getMeshDimension() ); logger.writeParameter( "Domain origin:", this->origin ); logger.writeParameter( "Domain proportions:", this->proportions ); logger.writeParameter( "Domain dimensions:", this->dimensions ); diff --git a/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h b/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h index 0f58430dd84e23f78492cc279ab24f571ccce9bb..853b7810feaca9076d183b37bb44a76e79e2c18f 100644 --- a/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h +++ b/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h @@ -32,13 +32,13 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index > typedef Meshes::Grid< 1, Real, Device, Index > GridType; typedef GridEntity< GridType, 1, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 ) * grid.getSpaceSteps().x() ); } }; @@ -53,13 +53,13 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index > typedef Meshes::Grid< 1, Real, Device, Index > GridType; typedef GridEntity< GridType, 0, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() ) * grid.getSpaceSteps().x() ); } }; @@ -77,13 +77,13 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index > typedef Meshes::Grid< 2, Real, Device, Index > GridType; typedef GridEntity< GridType, 2, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 ) * grid.getSpaceSteps().x(), grid.getOrigin().y() + ( entity.getCoordinates().y() + 0.5 ) * grid.getSpaceSteps().y() ); } @@ -99,13 +99,13 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index > typedef Meshes::Grid< 2, Real, Device, Index > GridType; typedef GridEntity< GridType, 1, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(), grid.getOrigin().y() + @@ -124,13 +124,13 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index > typedef Meshes::Grid< 2, Real, Device, Index > GridType; typedef GridEntity< GridType, 0, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + entity.getCoordinates().x() * grid.getSpaceSteps().x(), grid.getOrigin().y() + entity.getCoordinates().y() * grid.getSpaceSteps().y() ); } @@ -143,21 +143,21 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index > template< typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > -class GridEntityCenterGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, EntityDimensions, Config > > +class GridEntityCenterGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, EntityDimension, Config > > { public: typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(), grid.getOrigin().y() + @@ -177,13 +177,13 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index > typedef Meshes::Grid< 3, Real, Device, Index > GridType; typedef GridEntity< GridType, 3, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 ) * grid.getSpaceSteps().x(), grid.getOrigin().y() + ( entity.getCoordinates().y() + 0.5 ) * grid.getSpaceSteps().y(), grid.getOrigin().z() + ( entity.getCoordinates().z() + 0.5 ) * grid.getSpaceSteps().z() ); @@ -200,13 +200,13 @@ class GridEntityCenterGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index > typedef Meshes::Grid< 3, Real, Device, Index > GridType; typedef GridEntity< GridType, 0, Config > GridEntityType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; __cuda_callable__ inline - static VertexType getEntityCenter( const GridEntityType& entity ) + static PointType getEntityCenter( const GridEntityType& entity ) { const GridType& grid = entity.getMesh(); - return VertexType( + return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() ) * grid.getSpaceSteps().x(), grid.getOrigin().y() + ( entity.getCoordinates().y() ) * grid.getSpaceSteps().y(), grid.getOrigin().z() + ( entity.getCoordinates().z() ) * grid.getSpaceSteps().z() ); diff --git a/src/TNL/Meshes/GridDetails/GridEntityGetter.h b/src/TNL/Meshes/GridDetails/GridEntityGetter.h index 1467e99476e310cc56c47c84123f87c638010c0b..17f764052a8bda7d266dc209bab4bc1d43abe88a 100644 --- a/src/TNL/Meshes/GridDetails/GridEntityGetter.h +++ b/src/TNL/Meshes/GridDetails/GridEntityGetter.h @@ -15,7 +15,7 @@ namespace Meshes { template< typename Grid, typename GridEntity, - int EntityDimensions = GridEntity::entityDimensions > + int EntityDimension = GridEntity::entityDimension > class GridEntityGetter { //static_assert( false, "Wrong mesh type or entity topology." ); diff --git a/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h b/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h index 4c51e936a3078597c649aa293d8c451e4d542e3c..15ad36fac490dd33f351566bde7cbd0af1228044 100644 --- a/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h +++ b/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h @@ -25,20 +25,20 @@ template< typename Real, typename Device, typename Index, typename GridEntity, - int EntityDimensions > + int EntityDimension > class GridEntityGetter< Meshes::Grid< 1, Real, Device, Index >, GridEntity, - EntityDimensions > + EntityDimension > { public: - static const int entityDimensions = EntityDimensions; + static const int entityDimension = EntityDimension; typedef Meshes::Grid< 1, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -47,12 +47,12 @@ class GridEntityGetter< TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); return GridEntity ( grid, CoordinatesType( index ), typename GridEntity::EntityOrientationType( 0 ), - typename GridEntity::EntityBasisType( EntityDimensions ) ); + typename GridEntity::EntityBasisType( EntityDimension ) ); } __cuda_callable__ inline @@ -60,10 +60,10 @@ class GridEntityGetter< const GridEntity& entity ) { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0 ) && - entity.getCoordinates() < grid.getDimensions() + CoordinatesType( 1 - entityDimensions ), + entity.getCoordinates() < grid.getDimensions() + CoordinatesType( 1 - entityDimension ), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " grid.getDimensions() = " << grid.getDimensions() - << " EntityDimensions = " << entityDimensions ); + << " EntityDimension = " << entityDimension ); return entity.getCoordinates().x(); } }; @@ -79,12 +79,12 @@ class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 > { public: - static const int entityDimensions = 2; + static const int entityDimension = 2; typedef Meshes::Grid< 2, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -93,7 +93,7 @@ class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 > TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); const CoordinatesType dimensions = grid.getDimensions(); @@ -131,12 +131,12 @@ class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 > { public: - static const int entityDimensions = 1; + static const int entityDimension = 1; typedef Meshes::Grid< 2, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions, EntityConfig > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension, EntityConfig > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -145,7 +145,7 @@ class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 > TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); const CoordinatesType dimensions = grid.getDimensions(); @@ -194,12 +194,12 @@ class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 > { public: - static const int entityDimensions = 0; + static const int entityDimension = 0; typedef Meshes::Grid< 2, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -208,7 +208,7 @@ class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 > TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); const CoordinatesType dimensions = grid.getDimensions(); @@ -247,12 +247,12 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 > { public: - static const int entityDimensions = 3; + static const int entityDimension = 3; typedef Meshes::Grid< 3, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -261,7 +261,7 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 > TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); const CoordinatesType dimensions = grid.getDimensions(); @@ -299,12 +299,12 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 > { public: - static const int entityDimensions = 2; + static const int entityDimension = 2; typedef Meshes::Grid< 3, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -313,7 +313,7 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 > TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); const CoordinatesType dimensions = grid.getDimensions(); @@ -389,12 +389,12 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 > { public: - static const int entityDimensions = 1; + static const int entityDimension = 1; typedef Meshes::Grid< 3, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -403,7 +403,7 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 > TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); const CoordinatesType dimensions = grid.getDimensions(); @@ -479,12 +479,12 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 > { public: - static const int entityDimensions = 0; + static const int entityDimension = 0; typedef Meshes::Grid< 3, Real, Device, Index > GridType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - //typedef typename GridType::template GridEntity< entityDimensions > GridEntity; + //typedef typename GridType::template GridEntity< entityDimension > GridEntity; __cuda_callable__ inline static GridEntity getEntity( const GridType& grid, @@ -493,7 +493,7 @@ class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 > TNL_ASSERT( index >= 0 && index < grid.template getEntitiesCount< GridEntity >(), std::cerr << " index = " << index << " grid.getEntitiesCount<>() = " << grid.template getEntitiesCount< GridEntity >() - << " entityDimensions = " << entityDimensions ); + << " entityDimension = " << entityDimension ); const CoordinatesType dimensions = grid.getDimensions(); diff --git a/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h b/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h index 0bf847c3e83c3d36e741f1b974eb4da4d3c36b6a..a9823bf6c4e8b84d0daf0991f1ed87a722d12cfc 100644 --- a/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h +++ b/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h @@ -14,7 +14,7 @@ namespace TNL { namespace Meshes { template< typename Grid, - int EntityDimensions > + int EntityDimension > class GridEntityMeasureGetter { }; @@ -22,15 +22,15 @@ class GridEntityMeasureGetter /*** * Common implementation for vertices */ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index > -class GridEntityMeasureGetter< Meshes::Grid< Dimensions, Real, Device, Index >, 0 > +class GridEntityMeasureGetter< Meshes::Grid< Dimension, Real, Device, Index >, 0 > { public: - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; template< typename EntityType > __cuda_callable__ inline diff --git a/src/TNL/Meshes/GridDetails/GridEntityTopology.h b/src/TNL/Meshes/GridDetails/GridEntityTopology.h index 7d0bf23049d219b924ec24bdcdb529a705fbc6c2..716b2dcc2d662174dbf2006c450993adcce81bb4 100644 --- a/src/TNL/Meshes/GridDetails/GridEntityTopology.h +++ b/src/TNL/Meshes/GridDetails/GridEntityTopology.h @@ -15,7 +15,7 @@ namespace Meshes { template< typename Grid, - int EntityDimensions, + int EntityDimension, typename EntityOrientation_, typename EntityProportions_ > class GridEntityTopology @@ -25,17 +25,17 @@ class GridEntityTopology typedef Grid GridType; // TODO: restore when CUDA allows it - //static const int meshDimensions = GridType::Dimensions; - enum { meshDimensions = GridType::Dimensions }; + //static const int meshDimension = GridType::Dimension; + enum { meshDimension = GridType::Dimension }; - static const int entityDimensions = EntityDimensions; + static const int entityDimension = EntityDimension; typedef EntityOrientation_ EntityOrientation; typedef EntityProportions_ EntityProportions; // TODO: restore when CUDA allows it - //static_assert( meshDimensions == EntityOrientation_::size, + //static_assert( meshDimension == EntityOrientation_::size, // "Entity orientation is not a proper static multiindex." ); }; diff --git a/src/TNL/Meshes/GridDetails/GridEntity_impl.h b/src/TNL/Meshes/GridDetails/GridEntity_impl.h index 6cb58269e73c1d12d75d8e5b8f3b610b12c9156d..2fdfd8687fd2410d6a55698884bcfdd0d41b6a3d 100644 --- a/src/TNL/Meshes/GridDetails/GridEntity_impl.h +++ b/src/TNL/Meshes/GridDetails/GridEntity_impl.h @@ -19,44 +19,44 @@ namespace TNL { namespace Meshes { -/*template< int Dimensions, +/*template< int Dimension, typename Real, typename Device, typename Index, typename Config, - int EntityDimensions > + int EntityDimension > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension >:: GridEntity() { }*/ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: -GridEntity( const Meshes::Grid< Dimensions, Real, Device, Index >& grid ) +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: +GridEntity( const Meshes::Grid< Dimension, Real, Device, Index >& grid ) : grid( grid ), entityIndex( -1 ), coordinates( 0 ), orientation( 0 ), basis( 0 ), - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: -GridEntity( const Meshes::Grid< Dimensions, Real, Device, Index >& grid, +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: +GridEntity( const Meshes::Grid< Dimension, Real, Device, Index >& grid, const CoordinatesType& coordinates, const EntityOrientationType& orientation, const EntityBasisType& basis ) @@ -65,214 +65,214 @@ GridEntity( const Meshes::Grid< Dimensions, Real, Device, Index >& grid, coordinates( coordinates ), orientation( orientation ), basis( basis ), - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::CoordinatesType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::CoordinatesType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getCoordinates() const { return this->coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::CoordinatesType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::CoordinatesType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getCoordinates() { return this->coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: setCoordinates( const CoordinatesType& coordinates ) { this->coordinates = coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: refresh() { this->entityIndex = this->grid.getEntityIndex( *this ); - this->neighbourEntitiesStorage.refresh( this->grid, this->entityIndex ); + this->neighborEntitiesStorage.refresh( this->grid, this->entityIndex ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline Index -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getIndex() const { - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; - typedef typename GridType::template MeshEntity< EntityDimensions > EntityType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; + typedef typename GridType::template MeshEntity< EntityDimension > EntityType; TNL_ASSERT( this->entityIndex >= 0 && this-> entityIndex < grid.template getEntitiesCount< EntityType >(), std::cerr << "this->entityIndex = " << this->entityIndex - << " grid.template getEntitiesCount< EntityDimensions >() = " << grid.template getEntitiesCount< EntityType >() ); + << " grid.template getEntitiesCount< EntityDimension >() = " << grid.template getEntitiesCount< EntityType >() ); TNL_ASSERT( this->entityIndex == grid.getEntityIndex( *this ), std::cerr << "this->entityIndex = " << this->entityIndex << " grid.getEntityIndex( *this ) = " << grid.getEntityIndex( *this ) ); return this->entityIndex; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::EntityOrientationType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::EntityOrientationType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getOrientation() const { return this->orientation; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: setOrientation( const EntityOrientationType& orientation ) { this->orientation = orientation; this->basis = EntityBasisType( 1 ) - abs( orientation ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::EntityBasisType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::EntityBasisType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getBasis() const { return this->basis; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: setBasis( const EntityBasisType& basis ) { this->basis = basis; this->orientation = EntityOrientationType( 1 ) - abs( basis ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > - template< int NeighbourEntityDimensions > + template< int NeighborEntityDimension > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::template NeighbourEntities< NeighbourEntityDimensions >& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: -getNeighbourEntities() const +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::template NeighborEntities< NeighborEntityDimension >& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: +getNeighborEntities() const { - return neighbourEntitiesStorage.template getNeighbourEntities< NeighbourEntityDimensions >(); + return neighborEntitiesStorage.template getNeighborEntities< NeighborEntityDimension >(); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline bool -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: isBoundaryEntity() const { return BoundaryGridEntityChecker< ThisType >::isBoundaryEntity( *this ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -typename Meshes::Grid< Dimensions, Real, Device, Index >::VertexType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +typename Meshes::Grid< Dimension, Real, Device, Index >::PointType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getCenter() const { return GridEntityCenterGetter< ThisType >::getEntityCenter( *this ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::RealType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::RealType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getMeasure() const { - return GridEntityMeasureGetter< GridType, EntityDimensions >::getMeasure( this->getMesh(), *this ); + return GridEntityMeasureGetter< GridType, EntityDimension >::getMeasure( this->getMesh(), *this ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::GridType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::GridType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >:: getMesh() const { return this->grid; @@ -281,38 +281,38 @@ getMesh() const /**** * Specialization for cells */ -/*template< int Dimensions, +/*template< int Dimension, typename Real, typename Device, typename Index > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension >:: GridEntity() { }*/ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: GridEntity( const GridType& grid ) : grid( grid ), entityIndex( -1 ), - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { this->coordinates = CoordinatesType( ( Index ) 0 ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: GridEntity( const GridType& grid, const CoordinatesType& coordinates, const EntityOrientationType& orientation, @@ -320,184 +320,184 @@ GridEntity( const GridType& grid, : grid( grid ), entityIndex( -1 ), coordinates( coordinates ), - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::CoordinatesType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::CoordinatesType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getCoordinates() const { return this->coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::CoordinatesType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::CoordinatesType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getCoordinates() { return this->coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: setCoordinates( const CoordinatesType& coordinates ) { this->coordinates = coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: refresh() { this->entityIndex = this->grid.getEntityIndex( *this ); - this->neighbourEntitiesStorage.refresh( this->grid, this->entityIndex ); + this->neighborEntitiesStorage.refresh( this->grid, this->entityIndex ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline Index -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getIndex() const { TNL_ASSERT( this->entityIndex >= 0 && this-> entityIndex < grid.template getEntitiesCount< ThisType >(), std::cerr << "this->entityIndex = " << this->entityIndex - << " grid.template getEntitiesCount< Dimensions >() = " << grid.template getEntitiesCount< ThisType >() ); + << " grid.template getEntitiesCount< Dimension >() = " << grid.template getEntitiesCount< ThisType >() ); TNL_ASSERT( this->entityIndex == grid.getEntityIndex( *this ), std::cerr << "this->index = " << this->entityIndex << " grid.getEntityIndex( *this ) = " << grid.getEntityIndex( *this ) ); return this->entityIndex; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::EntityOrientationType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::EntityOrientationType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getOrientation() const { return EntityOrientationType( ( IndexType ) 0 ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::EntityBasisType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::EntityBasisType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getBasis() const { return EntityBasisType( ( IndexType ) 1 ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > - template< int NeighbourEntityDimensions > + template< int NeighborEntityDimension > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::template NeighbourEntities< NeighbourEntityDimensions >& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: -getNeighbourEntities() const +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::template NeighborEntities< NeighborEntityDimension >& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: +getNeighborEntities() const { - return neighbourEntitiesStorage.template getNeighbourEntities< NeighbourEntityDimensions >(); + return neighborEntitiesStorage.template getNeighborEntities< NeighborEntityDimension >(); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline bool -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: isBoundaryEntity() const { return BoundaryGridEntityChecker< ThisType >::isBoundaryEntity( *this ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -typename Meshes::Grid< Dimensions, Real, Device, Index >::VertexType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +typename Meshes::Grid< Dimension, Real, Device, Index >::PointType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getCenter() const { return GridEntityCenterGetter< ThisType >::getEntityCenter( *this ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::RealType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::RealType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getMeasure() const { return this->getMesh().getCellMeasure(); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::VertexType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::PointType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getEntityProportions() const { return grid.getSpaceSteps(); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >::GridType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::GridType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >:: getMesh() const { return this->grid; @@ -507,28 +507,28 @@ getMesh() const /**** * Specialization for vertices */ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: GridEntity( const GridType& grid ) : grid( grid ), entityIndex( -1 ), coordinates( 0 ), - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: GridEntity( const GridType& grid, const CoordinatesType& coordinates, const EntityOrientationType& orientation, @@ -536,74 +536,74 @@ GridEntity( const GridType& grid, : grid( grid ), entityIndex( -1 ), coordinates( coordinates ), - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::CoordinatesType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::CoordinatesType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getCoordinates() const { return this->coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::CoordinatesType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::CoordinatesType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getCoordinates() { return this->coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: setCoordinates( const CoordinatesType& coordinates ) { this->coordinates = coordinates; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline void -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: refresh() { this->entityIndex = this->grid.getEntityIndex( *this ); - this->neighbourEntitiesStorage.refresh( this->grid, this->entityIndex ); + this->neighborEntitiesStorage.refresh( this->grid, this->entityIndex ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline Index -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getIndex() const { - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; typedef typename GridType::Vertex Vertex; TNL_ASSERT( this->entityIndex >= 0 && this-> entityIndex < grid.template getEntitiesCount< Vertex >(), @@ -615,107 +615,107 @@ getIndex() const return this->entityIndex; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::EntityOrientationType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::EntityOrientationType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getOrientation() const { return EntityOrientationType( ( IndexType ) 0 ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::EntityBasisType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::EntityBasisType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getBasis() const { return EntityBasisType( ( IndexType ) 0 ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > - template< int NeighbourEntityDimensions > + template< int NeighborEntityDimension > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::template NeighbourEntities< NeighbourEntityDimensions >& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: -getNeighbourEntities() const +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::template NeighborEntities< NeighborEntityDimension >& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: +getNeighborEntities() const { - return neighbourEntitiesStorage.template getNeighbourEntities< NeighbourEntityDimensions >(); + return neighborEntitiesStorage.template getNeighborEntities< NeighborEntityDimension >(); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline bool -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: isBoundaryEntity() const { return BoundaryGridEntityChecker< ThisType >::isBoundaryEntity( *this ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -typename Meshes::Grid< Dimensions, Real, Device, Index >::VertexType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +typename Meshes::Grid< Dimension, Real, Device, Index >::PointType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getCenter() const { return GridEntityCenterGetter< ThisType >::getEntityCenter( *this ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::RealType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::RealType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getMeasure() const { return 0.0; } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::VertexType -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::PointType +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getEntityProportions() const { - return VertexType( 0.0 ); + return PointType( 0.0 ); } -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > __cuda_callable__ inline -const typename GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >::GridType& -GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config >:: +const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::GridType& +GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >:: getMesh() const { return this->grid; diff --git a/src/TNL/Meshes/GridDetails/GridTraverser_impl.h b/src/TNL/Meshes/GridDetails/GridTraverser_impl.h index 3cedde53c4285aa8cf1434309fc41998891d9a53..2adfb1b4cd34988f60760ff77635b51097226194 100644 --- a/src/TNL/Meshes/GridDetails/GridTraverser_impl.h +++ b/src/TNL/Meshes/GridDetails/GridTraverser_impl.h @@ -302,26 +302,114 @@ GridTraverser2D( UserData* userData, const typename GridEntity::CoordinatesType begin, const typename GridEntity::CoordinatesType end, - const Index gridXIdx, - const Index gridYIdx, + const dim3 gridIdx, const GridEntityParameters... gridEntityParameters ) { typedef Meshes::Grid< 2, Real, Devices::Cuda, Index > GridType; typename GridType::CoordinatesType coordinates; - coordinates.x() = begin.x() + ( gridXIdx * Devices::Cuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x; - coordinates.y() = begin.y() + ( gridYIdx * Devices::Cuda::getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y; - - if( ( !processOnlyBoundaryEntities && coordinates <= end ) || - ( processOnlyBoundaryEntities && - ( coordinates.x() == begin.x() || coordinates.y() == begin.y() || - coordinates.x() == end.x() || coordinates.y() == end.y() ) ) ) - { + coordinates.x() = begin.x() + Devices::Cuda::getGlobalThreadIdx_x( gridIdx ); + coordinates.y() = begin.y() + Devices::Cuda::getGlobalThreadIdx_y( gridIdx ); + + /*if( processOnlyBoundaryEntities && + ( GridEntity::getMeshDimension() == 2 || GridEntity::getMeshDimension() == 0 ) ) + { + if( coordinates.x() == begin.x() || coordinates.x() == end.x() || + coordinates.y() == begin.y() || coordinates.y() == end.y() ) + { + GridEntity entity( *grid, coordinates, gridEntityParameters... ); + entity.refresh(); + EntitiesProcessor::processEntity + ( *grid, + *userData, + entity ); + } + return; + }*/ + + + if( coordinates <= end ) + { GridEntity entity( *grid, coordinates, gridEntityParameters... ); entity.refresh(); - EntitiesProcessor::processEntity( entity.getMesh(), *userData, entity ); + if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() ) + { + EntitiesProcessor::processEntity + ( *grid, + *userData, + entity ); + } } } + +template< typename Real, + typename Index, + typename GridEntity, + typename UserData, + typename EntitiesProcessor, + bool processOnlyBoundaryEntities, + typename... GridEntityParameters > +__global__ void +GridTraverser2DBoundaryAlongX( + const Meshes::Grid< 2, Real, Devices::Cuda, Index >* grid, + UserData* userData, + const Index beginX, + const Index endX, + const Index fixedY, + const dim3 gridIdx, + const GridEntityParameters... gridEntityParameters ) +{ + typedef Meshes::Grid< 2, Real, Devices::Cuda, Index > GridType; + typename GridType::CoordinatesType coordinates; + + coordinates.x() = beginX + Devices::Cuda::getGlobalThreadIdx_x( gridIdx ); + coordinates.y() = fixedY; + + if( coordinates.x() <= endX ) + { + GridEntity entity( *grid, coordinates, gridEntityParameters... ); + entity.refresh(); + EntitiesProcessor::processEntity + ( *grid, + *userData, + entity ); + } +} + +template< typename Real, + typename Index, + typename GridEntity, + typename UserData, + typename EntitiesProcessor, + bool processOnlyBoundaryEntities, + typename... GridEntityParameters > +__global__ void +GridTraverser2DBoundaryAlongY( + const Meshes::Grid< 2, Real, Devices::Cuda, Index >* grid, + UserData* userData, + const Index beginY, + const Index endY, + const Index fixedX, + const dim3 gridIdx, + const GridEntityParameters... gridEntityParameters ) +{ + typedef Meshes::Grid< 2, Real, Devices::Cuda, Index > GridType; + typename GridType::CoordinatesType coordinates; + + coordinates.x() = fixedX; + coordinates.y() = beginY + Devices::Cuda::getGlobalThreadIdx_x( gridIdx ); + + if( coordinates.y() <= endY ) + { + GridEntity entity( *grid, coordinates, gridEntityParameters... ); + entity.refresh(); + EntitiesProcessor::processEntity + ( *grid, + *userData, + entity ); + } +} + #endif template< typename Real, @@ -344,36 +432,110 @@ processEntities( const int& stream, const GridEntityParameters&... gridEntityParameters ) { -#ifdef HAVE_CUDA - dim3 cudaBlockSize( 16, 16 ); - dim3 cudaBlocks; - cudaBlocks.x = Devices::Cuda::getNumberOfBlocks( end.x() - begin.x() + 1, cudaBlockSize.x ); - cudaBlocks.y = Devices::Cuda::getNumberOfBlocks( end.y() - begin.y() + 1, cudaBlockSize.y ); - const IndexType cudaXGrids = Devices::Cuda::getNumberOfGrids( cudaBlocks.x ); - const IndexType cudaYGrids = Devices::Cuda::getNumberOfGrids( cudaBlocks.y ); - - auto& pool = CudaStreamPool::getInstance(); - const cudaStream_t& s = pool.getStream( stream ); - - Devices::Cuda::synchronizeDevice(); - for( IndexType gridYIdx = 0; gridYIdx < cudaYGrids; gridYIdx ++ ) - for( IndexType gridXIdx = 0; gridXIdx < cudaXGrids; gridXIdx ++ ) - GridTraverser2D< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > - <<< cudaBlocks, cudaBlockSize, 0, s >>> - ( &gridPointer.template getData< Devices::Cuda >(), - &userDataPointer.template modifyData< Devices::Cuda >(), - begin, - end, - gridXIdx, - gridYIdx, - gridEntityParameters... ); - - // only launches into the stream 0 are synchronized - if( stream == 0 ) +#ifdef HAVE_CUDA + if( processOnlyBoundaryEntities && + ( GridEntity::getMeshDimension() == 2 || GridEntity::getMeshDimension() == 0 ) ) { - cudaStreamSynchronize( s ); + dim3 cudaBlockSize( 256 ); + dim3 cudaBlocksCountAlongX, cudaGridsCountAlongX, + cudaBlocksCountAlongY, cudaGridsCountAlongY; + Devices::Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongX, cudaGridsCountAlongX, end.x() - begin.x() + 1 ); + Devices::Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongY, cudaGridsCountAlongY, end.y() - begin.y() - 1 ); + + auto& pool = CudaStreamPool::getInstance(); + Devices::Cuda::synchronizeDevice(); + + const cudaStream_t& s1 = pool.getStream( stream ); + const cudaStream_t& s2 = pool.getStream( stream + 1 ); + dim3 gridIdx, cudaGridSize; + for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongX.x; gridIdx.x++ ) + { + Devices::Cuda::setupGrid( cudaBlocksCountAlongX, cudaGridsCountAlongX, gridIdx, cudaGridSize ); + //Devices::Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCountAlongX, cudaGridSize, cudaGridsCountAlongX ); + GridTraverser2DBoundaryAlongX< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaGridSize, cudaBlockSize, 0, s1 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.x(), + end.x(), + begin.y(), + gridIdx, + gridEntityParameters... ); + GridTraverser2DBoundaryAlongX< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaGridSize, cudaBlockSize, 0, s2 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.x(), + end.x(), + end.y(), + gridIdx, + gridEntityParameters... ); + } + const cudaStream_t& s3 = pool.getStream( stream + 2 ); + const cudaStream_t& s4 = pool.getStream( stream + 3 ); + for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongY.x; gridIdx.x++ ) + { + Devices::Cuda::setupGrid( cudaBlocksCountAlongY, cudaGridsCountAlongY, gridIdx, cudaGridSize ); + GridTraverser2DBoundaryAlongY< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaGridSize, cudaBlockSize, 0, s3 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.y() + 1, + end.y() - 1, + begin.x(), + gridIdx, + gridEntityParameters... ); + GridTraverser2DBoundaryAlongY< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaGridSize, cudaBlockSize, 0, s4 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.y() + 1, + end.y() - 1, + end.x(), + gridIdx, + gridEntityParameters... ); + } + cudaStreamSynchronize( s1 ); + cudaStreamSynchronize( s2 ); + cudaStreamSynchronize( s3 ); + cudaStreamSynchronize( s4 ); checkCudaDevice; } + else + { + dim3 cudaBlockSize( 16, 16 ); + dim3 cudaBlocksCount, cudaGridsCount; + Devices::Cuda::setupThreads( cudaBlockSize, cudaBlocksCount, cudaGridsCount, + end.x() - begin.x() + 1, + end.y() - begin.y() + 1 ); + + auto& pool = CudaStreamPool::getInstance(); + const cudaStream_t& s = pool.getStream( stream ); + + Devices::Cuda::synchronizeDevice(); + dim3 gridIdx, cudaGridSize; + for( gridIdx.y = 0; gridIdx.y < cudaGridsCount.y; gridIdx.y ++ ) + for( gridIdx.x = 0; gridIdx.x < cudaGridsCount.x; gridIdx.x ++ ) + { + Devices::Cuda::setupGrid( cudaBlocksCount, cudaGridsCount, gridIdx, cudaGridSize ); + //Devices::Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCount, cudaGridSize, cudaGridsCount ); + GridTraverser2D< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaGridSize, cudaBlockSize, 0, s >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin, + end, + gridIdx, + gridEntityParameters... ); + } + + // only launches into the stream 0 are synchronized + if( stream == 0 ) + { + cudaStreamSynchronize( s ); + checkCudaDevice; + } + } #endif } @@ -507,31 +669,17 @@ GridTraverser3D( UserData* userData, const typename GridEntity::CoordinatesType begin, const typename GridEntity::CoordinatesType end, - const Index gridXIdx, - const Index gridYIdx, - const Index gridZIdx, + const dim3 gridIdx, const GridEntityParameters... gridEntityParameters ) { typedef Meshes::Grid< 3, Real, Devices::Cuda, Index > GridType; typename GridType::CoordinatesType coordinates; - coordinates.x() = begin.x() + ( gridXIdx * Devices::Cuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x; - coordinates.y() = begin.y() + ( gridYIdx * Devices::Cuda::getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y; - coordinates.z() = begin.z() + ( gridZIdx * Devices::Cuda::getMaxGridSize() + blockIdx.z ) * blockDim.z + threadIdx.z; - - - if( ( !processOnlyBoundaryEntities && coordinates <= end ) || - ( processOnlyBoundaryEntities && - ( coordinates.x() == begin.x() || coordinates.y() == begin.y() || coordinates.z() == begin.z() || - coordinates.x() == end.x() || coordinates.y() == end.y() || coordinates.z() == end.z() ) ) ) - { - GridEntity entity( *grid, coordinates, gridEntityParameters... ); - entity.refresh(); - EntitiesProcessor::processEntity( entity.getMesh(), *userData, entity ); - } + coordinates.x() = begin.x() + Devices::Cuda::getGlobalThreadIdx_x( gridIdx ); + coordinates.y() = begin.y() + Devices::Cuda::getGlobalThreadIdx_y( gridIdx ); + coordinates.z() = begin.z() + Devices::Cuda::getGlobalThreadIdx_z( gridIdx ); - - /*if( coordinates <= end ) + if( coordinates <= end ) { GridEntity entity( *grid, coordinates, gridEntityParameters... ); entity.refresh(); @@ -542,7 +690,118 @@ GridTraverser3D( *userData, entity ); } - }*/ + } +} + +template< typename Real, + typename Index, + typename GridEntity, + typename UserData, + typename EntitiesProcessor, + bool processOnlyBoundaryEntities, + typename... GridEntityParameters > +__global__ void +GridTraverser3DBoundaryAlongXY( + const Meshes::Grid< 3, Real, Devices::Cuda, Index >* grid, + UserData* userData, + const Index beginX, + const Index endX, + const Index beginY, + const Index endY, + const Index fixedZ, + const dim3 gridIdx, + const GridEntityParameters... gridEntityParameters ) +{ + typedef Meshes::Grid< 3, Real, Devices::Cuda, Index > GridType; + typename GridType::CoordinatesType coordinates; + + coordinates.x() = beginX + Devices::Cuda::getGlobalThreadIdx_x( gridIdx ); + coordinates.y() = beginY + Devices::Cuda::getGlobalThreadIdx_y( gridIdx ); + coordinates.z() = fixedZ; + + if( coordinates.x() <= endX && coordinates.y() <= endY ) + { + GridEntity entity( *grid, coordinates, gridEntityParameters... ); + entity.refresh(); + EntitiesProcessor::processEntity + ( *grid, + *userData, + entity ); + } +} + +template< typename Real, + typename Index, + typename GridEntity, + typename UserData, + typename EntitiesProcessor, + bool processOnlyBoundaryEntities, + typename... GridEntityParameters > +__global__ void +GridTraverser3DBoundaryAlongXZ( + const Meshes::Grid< 3, Real, Devices::Cuda, Index >* grid, + UserData* userData, + const Index beginX, + const Index endX, + const Index beginZ, + const Index endZ, + const Index fixedY, + const dim3 gridIdx, + const GridEntityParameters... gridEntityParameters ) +{ + typedef Meshes::Grid< 3, Real, Devices::Cuda, Index > GridType; + typename GridType::CoordinatesType coordinates; + + coordinates.x() = beginX + Devices::Cuda::getGlobalThreadIdx_x( gridIdx ); + coordinates.y() = fixedY; + coordinates.z() = beginZ + Devices::Cuda::getGlobalThreadIdx_y( gridIdx ); + + if( coordinates.x() <= endX && coordinates.z() <= endZ ) + { + GridEntity entity( *grid, coordinates, gridEntityParameters... ); + entity.refresh(); + EntitiesProcessor::processEntity + ( *grid, + *userData, + entity ); + } +} + +template< typename Real, + typename Index, + typename GridEntity, + typename UserData, + typename EntitiesProcessor, + bool processOnlyBoundaryEntities, + typename... GridEntityParameters > +__global__ void +GridTraverser3DBoundaryAlongYZ( + const Meshes::Grid< 3, Real, Devices::Cuda, Index >* grid, + UserData* userData, + const Index beginY, + const Index endY, + const Index beginZ, + const Index endZ, + const Index fixedX, + const dim3 gridIdx, + const GridEntityParameters... gridEntityParameters ) +{ + typedef Meshes::Grid< 3, Real, Devices::Cuda, Index > GridType; + typename GridType::CoordinatesType coordinates; + + coordinates.x() = fixedX; + coordinates.y() = beginY + Devices::Cuda::getGlobalThreadIdx_x( gridIdx ); + coordinates.z() = beginZ + Devices::Cuda::getGlobalThreadIdx_y( gridIdx ); + + if( coordinates.y() <= endY && coordinates.z() <= endZ ) + { + GridEntity entity( *grid, coordinates, gridEntityParameters... ); + entity.refresh(); + EntitiesProcessor::processEntity + ( *grid, + *userData, + entity ); + } } #endif @@ -568,38 +827,157 @@ processEntities( const GridEntityParameters&... gridEntityParameters ) { #ifdef HAVE_CUDA - dim3 cudaBlockSize( 8, 8, 8 ); - dim3 cudaBlocks; - cudaBlocks.x = Devices::Cuda::getNumberOfBlocks( end.x() - begin.x() + 1, cudaBlockSize.x ); - cudaBlocks.y = Devices::Cuda::getNumberOfBlocks( end.y() - begin.y() + 1, cudaBlockSize.y ); - cudaBlocks.z = Devices::Cuda::getNumberOfBlocks( end.z() - begin.z() + 1, cudaBlockSize.z ); - const IndexType cudaXGrids = Devices::Cuda::getNumberOfGrids( cudaBlocks.x ); - const IndexType cudaYGrids = Devices::Cuda::getNumberOfGrids( cudaBlocks.y ); - const IndexType cudaZGrids = Devices::Cuda::getNumberOfGrids( cudaBlocks.z ); + if( processOnlyBoundaryEntities && + ( GridEntity::getMeshDimension() == 3 || GridEntity::getMeshDimension() == 0 ) ) + { + dim3 cudaBlockSize( 16, 16 ); + const IndexType entitiesAlongX = end.x() - begin.x() + 1; + const IndexType entitiesAlongY = end.y() - begin.y() + 1; + const IndexType entitiesAlongZ = end.z() - begin.z() + 1; + + dim3 cudaBlocksCountAlongXY, cudaBlocksCountAlongXZ, cudaBlocksCountAlongYZ, + cudaGridsCountAlongXY, cudaGridsCountAlongXZ, cudaGridsCountAlongYZ; + + Devices::Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongXY, cudaGridsCountAlongXY, entitiesAlongX, entitiesAlongY ); + Devices::Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongXZ, cudaGridsCountAlongXZ, entitiesAlongX, entitiesAlongZ - 2 ); + Devices::Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongYZ, cudaGridsCountAlongYZ, entitiesAlongY - 2, entitiesAlongZ - 2 ); - auto& pool = CudaStreamPool::getInstance(); - const cudaStream_t& s = pool.getStream( stream ); + auto& pool = CudaStreamPool::getInstance(); + Devices::Cuda::synchronizeDevice(); + + const cudaStream_t& s1 = pool.getStream( stream ); + const cudaStream_t& s2 = pool.getStream( stream + 1 ); + const cudaStream_t& s3 = pool.getStream( stream + 2 ); + const cudaStream_t& s4 = pool.getStream( stream + 3 ); + const cudaStream_t& s5 = pool.getStream( stream + 4 ); + const cudaStream_t& s6 = pool.getStream( stream + 5 ); + + dim3 gridIdx, gridSize; + for( gridIdx.y = 0; gridIdx.y < cudaGridsCountAlongXY.y; gridIdx.y++ ) + for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongXY.x; gridIdx.x++ ) + { + Devices::Cuda::setupGrid( cudaBlocksCountAlongXY, cudaGridsCountAlongXY, gridIdx, gridSize ); + GridTraverser3DBoundaryAlongXY< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaBlocksCountAlongXY, cudaBlockSize, 0 , s1 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.x(), + end.x(), + begin.y(), + end.y(), + begin.z(), + gridIdx, + gridEntityParameters... ); + GridTraverser3DBoundaryAlongXY< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaBlocksCountAlongXY, cudaBlockSize, 0, s2 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.x(), + end.x(), + begin.y(), + end.y(), + end.z(), + gridIdx, + gridEntityParameters... ); + } + for( gridIdx.y = 0; gridIdx.y < cudaGridsCountAlongXZ.y; gridIdx.y++ ) + for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongXZ.x; gridIdx.x++ ) + { + Devices::Cuda::setupGrid( cudaBlocksCountAlongXZ, cudaGridsCountAlongXZ, gridIdx, gridSize ); + GridTraverser3DBoundaryAlongXZ< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaBlocksCountAlongXZ, cudaBlockSize, 0, s3 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.x(), + end.x(), + begin.z() + 1, + end.z() - 1, + begin.y(), + gridIdx, + gridEntityParameters... ); + GridTraverser3DBoundaryAlongXZ< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaBlocksCountAlongXZ, cudaBlockSize, 0, s4 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.x(), + end.x(), + begin.z() + 1, + end.z() - 1, + end.y(), + gridIdx, + gridEntityParameters... ); + } + for( gridIdx.y = 0; gridIdx.y < cudaGridsCountAlongYZ.y; gridIdx.y++ ) + for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongYZ.x; gridIdx.x++ ) + { + Devices::Cuda::setupGrid( cudaBlocksCountAlongYZ, cudaGridsCountAlongYZ, gridIdx, gridSize ); + GridTraverser3DBoundaryAlongYZ< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaBlocksCountAlongYZ, cudaBlockSize, 0, s5 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.y() + 1, + end.y() - 1, + begin.z() + 1, + end.z() - 1, + begin.x(), + gridIdx, + gridEntityParameters... ); + GridTraverser3DBoundaryAlongYZ< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< cudaBlocksCountAlongYZ, cudaBlockSize, 0, s6 >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin.y() + 1, + end.y() - 1, + begin.z() + 1, + end.z() - 1, + end.x(), + gridIdx, + gridEntityParameters... ); + } + cudaStreamSynchronize( s1 ); + cudaStreamSynchronize( s2 ); + cudaStreamSynchronize( s3 ); + cudaStreamSynchronize( s4 ); + cudaStreamSynchronize( s5 ); + cudaStreamSynchronize( s6 ); + checkCudaDevice; + } + else + { + dim3 cudaBlockSize( 8, 8, 8 ); + dim3 cudaBlocksCount, cudaGridsCount; + + Devices::Cuda::setupThreads( cudaBlockSize, cudaBlocksCount, cudaGridsCount, + end.x() - begin.x() + 1, + end.y() - begin.y() + 1, + end.z() - begin.z() + 1 ); - Devices::Cuda::synchronizeDevice(); - for( IndexType gridZIdx = 0; gridZIdx < cudaZGrids; gridZIdx ++ ) - for( IndexType gridYIdx = 0; gridYIdx < cudaYGrids; gridYIdx ++ ) - for( IndexType gridXIdx = 0; gridXIdx < cudaXGrids; gridXIdx ++ ) - GridTraverser3D< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > - <<< cudaBlocks, cudaBlockSize, 0, s >>> - ( &gridPointer.template getData< Devices::Cuda >(), - &userDataPointer.template modifyData< Devices::Cuda >(), - begin, - end, - gridXIdx, - gridYIdx, - gridZIdx, - gridEntityParameters... ); + auto& pool = CudaStreamPool::getInstance(); + const cudaStream_t& s = pool.getStream( stream ); - // only launches into the stream 0 are synchronized - if( stream == 0 ) - { - cudaStreamSynchronize( s ); - checkCudaDevice; + Devices::Cuda::synchronizeDevice(); + dim3 gridIdx, gridSize; + for( gridIdx.z = 0; gridIdx.z < cudaGridsCount.z; gridIdx.z ++ ) + for( gridIdx.y = 0; gridIdx.y < cudaGridsCount.y; gridIdx.y ++ ) + for( gridIdx.x = 0; gridIdx.x < cudaGridsCount.x; gridIdx.x ++ ) + { + Devices::Cuda::setupGrid( cudaBlocksCount, cudaGridsCount, gridIdx, gridSize ); + GridTraverser3D< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... > + <<< gridSize, cudaBlockSize, 0, s >>> + ( &gridPointer.template getData< Devices::Cuda >(), + &userDataPointer.template modifyData< Devices::Cuda >(), + begin, + end, + gridIdx, + gridEntityParameters... ); + } + + // only launches into the stream 0 are synchronized + if( stream == 0 ) + { + cudaStreamSynchronize( s ); + checkCudaDevice; + } } #endif } diff --git a/src/TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h b/src/TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h new file mode 100644 index 0000000000000000000000000000000000000000..6447ee981a110f1d22be93a8fe39ccb8a25c2219 --- /dev/null +++ b/src/TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h @@ -0,0 +1,173 @@ +/*************************************************************************** + NeighborGridEntitiesStorage.h - description + ------------------- + begin : Dec 18, 2015 + copyright : (C) 2015 by Tomas Oberhuber + email : tomas.oberhuber@fjfi.cvut.cz + ***************************************************************************/ + +/* See Copyright Notice in tnl/Copyright */ + +#pragma once + +#include <TNL/Devices/Cuda.h> +#include <TNL/Meshes/MeshDimensionTag.h> +#include <TNL/Meshes/GridEntityConfig.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter.h> + +namespace TNL { +namespace Meshes { + +template< typename GridEntity, + int NeighborEntityDimension, + typename GridEntityConfig, + bool storage = GridEntityConfig::template neighborEntityStorage< GridEntity >( NeighborEntityDimension ) > +class NeighborGridEntityLayer{}; + +template< typename GridEntity, + int NeighborEntityDimension, + typename GridEntityConfig > +class NeighborGridEntityLayer< GridEntity, NeighborEntityDimension, GridEntityConfig, true > +: public NeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1, GridEntityConfig > +{ + public: + + typedef NeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1, GridEntityConfig > BaseType; + typedef NeighborGridEntityGetter< GridEntity, NeighborEntityDimension > NeighborEntityGetterType; + + using BaseType::getNeighborEntities; + + __cuda_callable__ + NeighborGridEntityLayer( const GridEntity& entity ) + : BaseType( entity ), + neighborEntities( entity ) + {} + + __cuda_callable__ + const NeighborEntityGetterType& getNeighborEntities( const MeshDimensionTag< NeighborEntityDimension>& tag ) const + { + return this->neighborEntities; + } + + __cuda_callable__ + void refresh( const typename GridEntity::GridType& grid, + const typename GridEntity::GridType::IndexType& entityIndex ) + { + BaseType::refresh( grid, entityIndex ); + neighborEntities.refresh( grid, entityIndex ); + } + + protected: + + NeighborEntityGetterType neighborEntities; +}; + +template< typename GridEntity, + typename GridEntityConfig > +class NeighborGridEntityLayer< GridEntity, 0, GridEntityConfig, true > +{ + public: + + typedef NeighborGridEntityGetter< GridEntity, 0 > NeighborEntityGetterType; + + __cuda_callable__ + NeighborGridEntityLayer( const GridEntity& entity ) + : neighborEntities( entity ) + {} + + __cuda_callable__ + const NeighborEntityGetterType& getNeighborEntities( const MeshDimensionTag< 0 >& tag ) const + { + return this->neighborEntities; + } + + __cuda_callable__ + void refresh( const typename GridEntity::GridType& grid, + const typename GridEntity::GridType::IndexType& entityIndex ) + { + neighborEntities.refresh( grid, entityIndex ); + } + + protected: + + NeighborEntityGetterType neighborEntities; +}; + +template< typename GridEntity, + int NeighborEntityDimension, + typename GridEntityConfig > +class NeighborGridEntityLayer< GridEntity, NeighborEntityDimension, GridEntityConfig, false > +: public NeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1, GridEntityConfig > +{ + public: + + typedef NeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1, GridEntityConfig > BaseType; + typedef NeighborGridEntityGetter< GridEntity, NeighborEntityDimension > NeighborEntityGetterType; + + using BaseType::getNeighborEntities; + + __cuda_callable__ + NeighborGridEntityLayer( const GridEntity& entity ) + : BaseType( entity ) + {} + + __cuda_callable__ + const NeighborEntityGetterType& getNeighborEntities( const MeshDimensionTag< NeighborEntityDimension >& tag ) const {} + + __cuda_callable__ + void refresh( const typename GridEntity::GridType& grid, + const typename GridEntity::GridType::IndexType& entityIndex ) {} +}; + +template< typename GridEntity, + typename GridEntityConfig > +class NeighborGridEntityLayer< GridEntity, 0, GridEntityConfig, false > +{ + public: + + typedef NeighborGridEntityGetter< GridEntity, 0 > NeighborEntityGetterType; + + __cuda_callable__ + NeighborGridEntityLayer( const GridEntity& entity ){} + + __cuda_callable__ + const NeighborEntityGetterType& getNeighborEntities( const MeshDimensionTag< 0 >& tag ) const {} + + __cuda_callable__ + void refresh( const typename GridEntity::GridType& grid, + const typename GridEntity::GridType::IndexType& entityIndex ) {} +}; + + + + +template< typename GridEntity, + typename GridEntityConfig > +class NeighborGridEntitiesStorage +: public NeighborGridEntityLayer< GridEntity, GridEntity::meshDimension, GridEntityConfig > +{ + typedef NeighborGridEntityLayer< GridEntity, GridEntity::meshDimension, GridEntityConfig > BaseType; + + public: + + using BaseType::getNeighborEntities; + using BaseType::refresh; + + __cuda_callable__ + NeighborGridEntitiesStorage( const GridEntity& entity ) + : BaseType( entity ) + {} + + template< int EntityDimension > + __cuda_callable__ + const NeighborGridEntityGetter< GridEntity, EntityDimension >& + getNeighborEntities() const + { + return BaseType::getNeighborEntities( MeshDimensionTag< EntityDimension >() ); + } +}; + + +} // namespace Meshes +} // namespace TNL + diff --git a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter.h similarity index 78% rename from src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h rename to src/TNL/Meshes/GridDetails/NeighborGridEntityGetter.h index e956b31c45732650101f0cc3b11157cf77ecce00..300fa97d55df6adca4d2013eea2d543b8d00f07b 100644 --- a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h +++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter.h @@ -1,5 +1,5 @@ /*************************************************************************** - NeighbourGridEntityGetter.h - description + NeighborGridEntityGetter.h - description ------------------- begin : Nov 23, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -17,17 +17,17 @@ namespace TNL { namespace Meshes { template< typename GridEntity, - int NeighbourEntityDimensions, + int NeighborEntityDimension, typename EntityStencilTag = - GridEntityStencilStorageTag< GridEntity::ConfigType::template neighbourEntityStorage< GridEntity >( NeighbourEntityDimensions ) > > -class NeighbourGridEntityGetter + GridEntityStencilStorageTag< GridEntity::ConfigType::template neighborEntityStorage< GridEntity >( NeighborEntityDimension ) > > +class NeighborGridEntityGetter { public: // TODO: not all specializations are implemented yet __cuda_callable__ - NeighbourGridEntityGetter( const GridEntity& entity ) + NeighborGridEntityGetter( const GridEntity& entity ) { //TNL_ASSERT( false, ); } diff --git a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter1D_impl.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h similarity index 73% rename from src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter1D_impl.h rename to src/TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h index 246c508d49ba4eb9ce010f5182d20d077e09f873..20013f3d3e0d0c5285316e916c94e77841ca8a1a 100644 --- a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter1D_impl.h +++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - NeighbourGridEntityGetter1D_impl.h - description + NeighborGridEntityGetter1D_impl.h - description ------------------- begin : Nov 23, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -10,7 +10,7 @@ #pragma once -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter.h> #include <TNL/Meshes/GridDetails/Grid1D.h> #include <TNL/Meshes/GridDetails/Grid2D.h> #include <TNL/Meshes/GridDetails/Grid3D.h> @@ -21,7 +21,7 @@ namespace Meshes { /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 1 | 1 | ---- | * +-----------------+---------------------------+-------------------+ @@ -30,43 +30,43 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >, 1, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 1; - static const int NeighbourEntityDimensions = 1; + static const int EntityDimension = 1; + static const int NeighborEntityDimension = 1; typedef Meshes::Grid< 1, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int step > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( this->entity.getCoordinates() >= CoordinatesType( 0 ) && this->entity.getCoordinates() < this->entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << this->entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( step ) >= CoordinatesType( 0 ) && entity.getCoordinates() + CoordinatesType( step ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) ); + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) ); } template< int step > @@ -77,12 +77,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( step ) >= CoordinatesType( 0 ) && entity.getCoordinates() + CoordinatesType( step ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + step; } @@ -97,7 +97,7 @@ class NeighbourGridEntityGetter< /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 1 | 1 | Cross/Full | * +-----------------+---------------------------+-------------------+ @@ -107,46 +107,46 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >, 1, StencilStorage > { public: - static const int EntityDimensions = 1; - static const int NeighbourEntityDimensions = 1; + static const int EntityDimension = 1; + static const int NeighborEntityDimension = 1; typedef Meshes::Grid< 1, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; - typedef NeighbourGridEntityGetter< GridEntityType, 1, StencilStorage > ThisType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; + typedef NeighborGridEntityGetter< GridEntityType, 1, StencilStorage > ThisType; static const int stencilSize = Config::getStencilSize(); __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int step > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( this->entity.getCoordinates() >= CoordinatesType( 0 ) && this->entity.getCoordinates() < this->entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << this->entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( step ) >= CoordinatesType( 0 ) && entity.getCoordinates() + CoordinatesType( step ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + step ) ); + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + step ) ); } template< int step > @@ -157,12 +157,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( step ) >= CoordinatesType( 0 ) && entity.getCoordinates() + CoordinatesType( step ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); #ifndef HAVE_CUDA // TODO: fix it -- does not work with nvcc if( step < -stencilSize || step > stencilSize ) return this->entity.getIndex() + step; @@ -179,9 +179,9 @@ class NeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; + neighborEntityGetter.stencil[ index + stencilSize ] = entityIndex + index; } }; @@ -202,7 +202,7 @@ class NeighbourGridEntityGetter< /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 1 | 0 | None | * +-----------------+---------------------------+-------------------+ @@ -211,43 +211,43 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >, 0, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 1; - static const int NeighbourEntityDimensions = 0; + static const int EntityDimension = 1; + static const int NeighborEntityDimension = 0; typedef Meshes::Grid< 1, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int step > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0 ) && entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step + ( step < 0 ) >= CoordinatesType( 0 ) && entity.getCoordinates().x() + step + ( step < 0 ) <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step + ( step < 0 ) ) ); + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step + ( step < 0 ) ) ); } template< int step > @@ -258,12 +258,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step + ( step < 0 ) >= CoordinatesType( 0 ).x() && entity.getCoordinates().x() + step + ( step < 0 ) <= entity.getMesh().getDimensions().x(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + step + ( step < 0 ); } @@ -274,13 +274,13 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 0 | 1 | None | * +-----------------+---------------------------+-------------------+ @@ -290,25 +290,25 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >, 1, StencilStorage > //GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 0; - static const int NeighbourEntityDimensions = 1; + static const int EntityDimension = 0; + static const int NeighborEntityDimension = 1; typedef Meshes::Grid< 1, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} @@ -316,19 +316,19 @@ class NeighbourGridEntityGetter< template< int step > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0 ) && entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step - ( step > 0 ) >= CoordinatesType( 0 ) && entity.getCoordinates().x() + step - ( step > 0 ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) ); + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) ); } template< int step > @@ -339,12 +339,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step - ( step > 0 ) >= 0 && entity.getCoordinates().x() + step - ( step > 0 ) < entity.getMesh().getDimensions().x(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + step - ( step > 0 ); } @@ -358,7 +358,7 @@ class NeighbourGridEntityGetter< /**** TODO: Implement this, now it is only a copy of specialization for none stencil storage * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 0 | 1 | Cross | * +-----------------+---------------------------+-------------------+ @@ -367,44 +367,44 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >, 1, GridEntityStencilStorageTag< GridEntityCrossStencil > > { public: - static const int EntityDimensions = 0; - static const int NeighbourEntityDimensions = 1; + static const int EntityDimension = 0; + static const int NeighborEntityDimension = 1; typedef Meshes::Grid< 1, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int step > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0 ) && entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step - ( step > 0 ) >= CoordinatesType( 0 ) && entity.getCoordinates().x() + step - ( step > 0 ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) ); + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) ); } template< int step > @@ -415,12 +415,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step - ( step > 0 ) >= CoordinatesType( 0 ) && entity.getCoordinates().x() + step - ( step > 0 ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + step - ( step > 0 ); } @@ -435,7 +435,7 @@ class NeighbourGridEntityGetter< /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 0 | 0 | None | * +-----------------+---------------------------+-------------------+ @@ -444,43 +444,43 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >, 0, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 0; - static const int NeighbourEntityDimensions = 0; + static const int EntityDimension = 0; + static const int NeighborEntityDimension = 0; typedef Meshes::Grid< 1, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int step > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0 ) && entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step >= CoordinatesType( 0 ) && entity.getCoordinates().x() + step <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) ); + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) ); } template< int step > @@ -491,12 +491,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates().x() + step >= CoordinatesType( 0 ) && entity.getCoordinates().x() + step <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + step; } diff --git a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter2D_impl.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h similarity index 77% rename from src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter2D_impl.h rename to src/TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h index b87c08d325ccb08fc4bb17f267f8bd4e34d0d436..461e7107b9dfeb220358b38302f3f8499f8f8508 100644 --- a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter2D_impl.h +++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - NeighbourGridEntityGetter2D_impl.h - description + NeighborGridEntityGetter2D_impl.h - description ------------------- begin : Nov 23, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -10,7 +10,7 @@ #pragma once -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter.h> #include <TNL/Meshes/GridDetails/Grid1D.h> #include <TNL/Meshes/GridDetails/Grid2D.h> #include <TNL/Meshes/GridDetails/Grid3D.h> @@ -20,7 +20,7 @@ namespace Meshes { /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 2 | 2 | No specialization | * +-----------------+---------------------------+-------------------+ @@ -30,43 +30,43 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 2, StencilStorage > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0, 0 ) && entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY ) >= CoordinatesType( 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->grid, + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->grid, CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY ) ); } @@ -79,12 +79,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY ) >= CoordinatesType( 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX; } @@ -95,12 +95,12 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 2 | 2 | Cross | * +-----------------+---------------------------+-------------------+ @@ -109,48 +109,48 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 2, GridEntityStencilStorageTag< GridEntityCrossStencil > > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; typedef GridEntityStencilStorageTag< GridEntityCrossStencil > StencilStorage; - typedef NeighbourGridEntityGetter< GridEntityType, 2, StencilStorage > ThisType; + typedef NeighborGridEntityGetter< GridEntityType, 2, StencilStorage > ThisType; static const int stencilSize = Config::getStencilSize(); __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0, 0 ) && entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY ) >= CoordinatesType( 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->entity.getMesh(), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY ) ); } @@ -163,12 +163,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY ) >= CoordinatesType( 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); #ifndef HAVE_CUDA // TODO: fix this to work with CUDA if( ( stepX != 0 && stepY != 0 ) || ( stepX < -stencilSize || stepX > stencilSize || @@ -189,9 +189,9 @@ class NeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencilX[ index + stencilSize ] = entityIndex + index; + neighborEntityGetter.stencilX[ index + stencilSize ] = entityIndex + index; } }; @@ -201,10 +201,10 @@ class NeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencilY[ index + stencilSize ] = - entityIndex + index * neighbourEntityGetter.entity.getMesh().getDimensions().x(); + neighborEntityGetter.stencilY[ index + stencilSize ] = + entityIndex + index * neighborEntityGetter.entity.getMesh().getDimensions().x(); } }; @@ -226,12 +226,12 @@ class NeighbourGridEntityGetter< IndexType stencilX[ 2 * stencilSize + 1 ]; IndexType stencilY[ 2 * stencilSize + 1 ]; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 2 | 1 | None | * +-----------------+---------------------------+-------------------+ @@ -241,33 +241,33 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 1, StencilStorage > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 1; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 1; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; typedef typename GridEntityType::EntityOrientationType EntityOrientationType; typedef typename GridEntityType::EntityBasisType EntityBasisType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( ! stepX + ! stepY == 1, std::cerr << "Only one of the steps can be non-zero: stepX = " << stepX << " stepY = " << stepY ); @@ -275,7 +275,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) >= CoordinatesType( 0, 0 ) && @@ -286,8 +286,8 @@ class NeighbourGridEntityGetter< std::cerr << "entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) = " << entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->entity.getMesh(), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), entity.getCoordinates().y() + stepY + ( stepY < 0 ) ), EntityOrientationType( stepX ? (stepX > 0 ? 1 : -1) : 0, @@ -312,7 +312,7 @@ class NeighbourGridEntityGetter< /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 2 | 0 | None | * +-----------------+---------------------------+-------------------+ @@ -322,31 +322,31 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 0, StencilStorage > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 0; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 0; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( stepX != 0 && stepY != 0, std::cerr << " stepX = " << stepX << " stepY = " << stepY ); @@ -354,7 +354,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) >= CoordinatesType( 0, 0 ) && entity.getCoordinates() + @@ -364,8 +364,8 @@ class NeighbourGridEntityGetter< << entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) << " entity.getMesh().getDimensions() + CoordinatesType( sign( stepX ), sign( stepY ) ) = " << entity.getMesh().getDimensions() + CoordinatesType( sign( stepX ), sign( stepY ) ) - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->grid, + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->grid, CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), entity.getCoordinates().y() + stepY + ( stepY < 0 ) ) ); } @@ -384,12 +384,12 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 1 | 2 | None | * +-----------------+---------------------------+-------------------+ @@ -399,31 +399,31 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 1, Config >, 2, StencilStorage > { public: - static const int EntityDimensions = 1; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 1; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { /*TNL_ASSERT( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) && ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ), @@ -433,7 +433,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions() + entity.getOrientation(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() + entity.getOrientation() = " << entity.getMesh().getDimensions() + entity.getOrientation() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ), stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) ) >= CoordinatesType( 0, 0 ) && @@ -443,8 +443,8 @@ class NeighbourGridEntityGetter< std::cerr << "entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ), stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ) ) = " << entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->entity.getMesh(), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ), entity.getCoordinates().y() + stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) ) ); } @@ -466,7 +466,7 @@ class NeighbourGridEntityGetter< /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 0 | 0 | None | * +-----------------+---------------------------+-------------------+ @@ -476,43 +476,43 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 0, Config >, 0, StencilStorage > { public: - static const int EntityDimensions = 0; - static const int NeighbourEntityDimensions = 0; + static const int EntityDimension = 0; + static const int NeighborEntityDimension = 0; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0, 0 ) && entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY ) >= CoordinatesType( 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY ) <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->grid, + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->grid, CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY ) ); } @@ -525,12 +525,12 @@ class NeighbourGridEntityGetter< entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY ) >= CoordinatesType( 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY ) <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + stepY * ( entity.getMesh().getDimensions().x() + 1 ) + stepX; } @@ -541,7 +541,7 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; } // namespace Meshes diff --git a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter3D_impl.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h similarity index 79% rename from src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter3D_impl.h rename to src/TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h index e14eb0fbc1c62c2f49296de72d9a601c4f5d609e..bfe398777d5265dc1e392061f563450679b441be 100644 --- a/src/TNL/Meshes/GridDetails/NeighbourGridEntityGetter3D_impl.h +++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - NeighbourGridEntityGetter3D_impl.h - description + NeighborGridEntityGetter3D_impl.h - description ------------------- begin : Nov 23, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -10,7 +10,7 @@ #pragma once -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntityGetter.h> #include <TNL/Meshes/GridDetails/Grid1D.h> #include <TNL/Meshes/GridDetails/Grid2D.h> #include <TNL/Meshes/GridDetails/Grid3D.h> @@ -21,7 +21,7 @@ namespace Meshes { /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 3 | 3 | None | * +-----------------+---------------------------+-------------------+ @@ -30,43 +30,43 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >, 3, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 3; - static const int NeighbourEntityDimensions = 3; + static const int EntityDimension = 3; + static const int NeighborEntityDimension = 3; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY, int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY ) >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX, + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY, entity.getCoordinates().z() + stepZ ) ); } @@ -79,13 +79,13 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX; } @@ -96,14 +96,14 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 3 | 3 | Cross | * +-----------------+---------------------------+-------------------+ @@ -112,47 +112,47 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >, 3, GridEntityStencilStorageTag< GridEntityCrossStencil > > { public: - static const int EntityDimensions = 3; - static const int NeighbourEntityDimensions = 3; + static const int EntityDimension = 3; + static const int NeighborEntityDimension = 3; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; typedef GridEntityStencilStorageTag< GridEntityCrossStencil > StencilStorage; - typedef NeighbourGridEntityGetter< GridEntityType, 3, StencilStorage > ThisType; + typedef NeighborGridEntityGetter< GridEntityType, 3, StencilStorage > ThisType; static const int stencilSize = Config::getStencilSize(); __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY, int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX, + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY, entity.getCoordinates().z() + stepZ ) ); } @@ -165,13 +165,13 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); #ifndef HAVE_CUDA // TODO: fix this to work with CUDA if( ( stepX != 0 && stepY != 0 && stepZ != 0 ) || ( stepX < -stencilSize || stepX > stencilSize || @@ -195,9 +195,9 @@ class NeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencilX[ index + stencilSize ] = entityIndex + index; + neighborEntityGetter.stencilX[ index + stencilSize ] = entityIndex + index; } }; @@ -207,10 +207,10 @@ class NeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencilY[ index + stencilSize ] = - entityIndex + index * neighbourEntityGetter.entity.getMesh().getDimensions().x(); + neighborEntityGetter.stencilY[ index + stencilSize ] = + entityIndex + index * neighborEntityGetter.entity.getMesh().getDimensions().x(); } }; @@ -220,10 +220,10 @@ class NeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencilZ[ index + stencilSize ] = - entityIndex + index * neighbourEntityGetter.entity.getMesh().cellZNeighboursStep; + neighborEntityGetter.stencilZ[ index + stencilSize ] = + entityIndex + index * neighborEntityGetter.entity.getMesh().cellZNeighborsStep; } }; @@ -248,12 +248,12 @@ class NeighbourGridEntityGetter< IndexType stencilY[ 2 * stencilSize + 1 ]; IndexType stencilZ[ 2 * stencilSize + 1 ]; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 3 | 2 | None | * +-----------------+---------------------------+-------------------+ @@ -262,33 +262,33 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >, 2, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 3; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 3; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; typedef typename GridEntityType::EntityOrientationType EntityOrientationType; typedef typename GridEntityType::EntityBasisType EntityBasisType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY, int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( ! stepX + ! stepY + ! stepZ == 2, std::cerr << "Only one of the steps can be non-zero: stepX = " << stepX @@ -298,7 +298,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), @@ -312,8 +312,8 @@ class NeighbourGridEntityGetter< std::cerr << "entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) = " << entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->entity.getMesh(), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), entity.getCoordinates().y() + stepY + ( stepY < 0 ), entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ), @@ -337,12 +337,12 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** TODO: Finish it, knonw it is only a copy of specialization for none stored stencil * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 3 | 2 | Cross | * +-----------------+---------------------------+-------------------+ @@ -351,33 +351,33 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >, 2, GridEntityStencilStorageTag< GridEntityCrossStencil > > { public: - static const int EntityDimensions = 3; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 3; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; typedef typename GridEntityType::EntityOrientationType EntityOrientationType; typedef typename GridEntityType::EntityBasisType EntityBasisType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY, int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( ! stepX + ! stepY + ! stepZ == 2, std::cerr << "Only one of the steps can be non-zero: stepX = " << stepX @@ -387,7 +387,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), @@ -401,8 +401,8 @@ class NeighbourGridEntityGetter< std::cerr << "entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) = " << entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( this->entity.getMesh(), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), entity.getCoordinates().y() + stepY + ( stepY < 0 ), entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ), @@ -426,13 +426,13 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 3 | 1 | None | * +-----------------+---------------------------+-------------------+ @@ -441,33 +441,33 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >, 1, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 3; - static const int NeighbourEntityDimensions = 1; + static const int EntityDimension = 3; + static const int NeighborEntityDimension = 1; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; typedef typename GridEntityType::EntityOrientationType EntityOrientationType; typedef typename GridEntityType::EntityBasisType EntityBasisType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY, int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( ! stepX + ! stepY + ! stepZ == 1, std::cerr << "Exactly two of the steps must be non-zero: stepX = " << stepX @@ -477,7 +477,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), @@ -491,8 +491,8 @@ class NeighbourGridEntityGetter< std::cerr << "entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) = " << entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), entity.getCoordinates().y() + stepY + ( stepY < 0 ), entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ), EntityOrientationType( !!stepX, !!stepY, !!stepZ ), @@ -513,13 +513,13 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 3 | 0 | None | * +-----------------+---------------------------+-------------------+ @@ -528,31 +528,31 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >, 0, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 3; - static const int NeighbourEntityDimensions = 0; + static const int EntityDimension = 3; + static const int NeighborEntityDimension = 0; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY,int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( stepX != 0 && stepY != 0 && stepZ != 0, std::cerr << " stepX = " << stepX @@ -562,7 +562,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), @@ -577,8 +577,8 @@ class NeighbourGridEntityGetter< << entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) ) << " entity.getMesh().getDimensions() + CoordinatesType( sign( stepX ), sign( stepY ), sign( stepZ ) ) = " << entity.getMesh().getDimensions() + CoordinatesType( sign( stepX ), sign( stepY ), sign( stepZ ) ) - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ), entity.getCoordinates().y() + stepY + ( stepY < 0 ), entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ) ); } @@ -597,12 +597,12 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 2 | 3 | None | * +-----------------+---------------------------+-------------------+ @@ -611,31 +611,31 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 2, Config >, 3, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 3; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 3; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY, int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { /*TNL_ASSERT( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) && ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ) && @@ -647,7 +647,7 @@ class NeighbourGridEntityGetter< entity.getCoordinates() < entity.getMesh().getDimensions() + entity.getOrientation(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() + entity.getOrientation() = " << entity.getMesh().getDimensions() + entity.getOrientation() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ), stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ), @@ -662,8 +662,8 @@ class NeighbourGridEntityGetter< stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ), stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntityType( entity.getMesh(), + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntityType( entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ), entity.getCoordinates().y() + stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ), entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) ); @@ -683,12 +683,12 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stored Stencil | + * | EntityDimenions | NeighborEntityDimension | Stored Stencil | * +-----------------+---------------------------+-------------------+ * | 0 | 0 | None | * +-----------------+---------------------------+-------------------+ @@ -697,44 +697,44 @@ template< typename Real, typename Device, typename Index, typename Config > -class NeighbourGridEntityGetter< +class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 0, Config >, 0, GridEntityStencilStorageTag< GridEntityNoStencil > > { public: - static const int EntityDimensions = 0; - static const int NeighbourEntityDimensions = 0; + static const int EntityDimension = 0; + static const int NeighborEntityDimension = 0; typedef Meshes::Grid< 3, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetterType; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetterType; __cuda_callable__ inline - NeighbourGridEntityGetter( const GridEntityType& entity ) + NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} template< int stepX, int stepY, int stepZ > __cuda_callable__ inline - NeighbourGridEntityType getEntity() const + NeighborGridEntityType getEntity() const { TNL_ASSERT( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); - return NeighbourGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX, + << " EntityDimension = " << EntityDimension ); + return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY, entity.getCoordinates().z() + stepZ ) ); } @@ -747,13 +747,13 @@ class NeighbourGridEntityGetter< entity.getCoordinates() <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() = " << entity.getCoordinates() << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) >= CoordinatesType( 0, 0, 0 ) && entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) <= entity.getMesh().getDimensions(), std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ ) << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions() - << " EntityDimensions = " << EntityDimensions ); + << " EntityDimension = " << EntityDimension ); return this->entity.getIndex() + stepZ * ( entity.getMesh().getDimensions().y() + 1 + stepY ) * ( entity.getMesh().getDimensions().x() + 1 ) + stepX; } @@ -764,7 +764,7 @@ class NeighbourGridEntityGetter< const GridEntityType& entity; - //NeighbourGridEntityGetter(){}; + //NeighborGridEntityGetter(){}; }; diff --git a/src/TNL/Meshes/GridDetails/NeighbourGridEntitiesStorage.h b/src/TNL/Meshes/GridDetails/NeighbourGridEntitiesStorage.h deleted file mode 100644 index ad2edb43108d768a289493f3c33c16f497a72b1f..0000000000000000000000000000000000000000 --- a/src/TNL/Meshes/GridDetails/NeighbourGridEntitiesStorage.h +++ /dev/null @@ -1,173 +0,0 @@ -/*************************************************************************** - NeighbourGridEntitiesStorage.h - description - ------------------- - begin : Dec 18, 2015 - copyright : (C) 2015 by Tomas Oberhuber - email : tomas.oberhuber@fjfi.cvut.cz - ***************************************************************************/ - -/* See Copyright Notice in tnl/Copyright */ - -#pragma once - -#include <TNL/Devices/Cuda.h> -#include <TNL/Meshes/MeshDimensionsTag.h> -#include <TNL/Meshes/GridEntityConfig.h> -#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h> - -namespace TNL { -namespace Meshes { - -template< typename GridEntity, - int NeighbourEntityDimensions, - typename GridEntityConfig, - bool storage = GridEntityConfig::template neighbourEntityStorage< GridEntity >( NeighbourEntityDimensions ) > -class NeighbourGridEntityLayer{}; - -template< typename GridEntity, - int NeighbourEntityDimensions, - typename GridEntityConfig > -class NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions, GridEntityConfig, true > -: public NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1, GridEntityConfig > -{ - public: - - typedef NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1, GridEntityConfig > BaseType; - typedef NeighbourGridEntityGetter< GridEntity, NeighbourEntityDimensions > NeighbourEntityGetterType; - - using BaseType::getNeighbourEntities; - - __cuda_callable__ - NeighbourGridEntityLayer( const GridEntity& entity ) - : BaseType( entity ), - neighbourEntities( entity ) - {} - - __cuda_callable__ - const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< NeighbourEntityDimensions>& tag ) const - { - return this->neighbourEntities; - } - - __cuda_callable__ - void refresh( const typename GridEntity::GridType& grid, - const typename GridEntity::GridType::IndexType& entityIndex ) - { - BaseType::refresh( grid, entityIndex ); - neighbourEntities.refresh( grid, entityIndex ); - } - - protected: - - NeighbourEntityGetterType neighbourEntities; -}; - -template< typename GridEntity, - typename GridEntityConfig > -class NeighbourGridEntityLayer< GridEntity, 0, GridEntityConfig, true > -{ - public: - - typedef NeighbourGridEntityGetter< GridEntity, 0 > NeighbourEntityGetterType; - - __cuda_callable__ - NeighbourGridEntityLayer( const GridEntity& entity ) - : neighbourEntities( entity ) - {} - - __cuda_callable__ - const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< 0 >& tag ) const - { - return this->neighbourEntities; - } - - __cuda_callable__ - void refresh( const typename GridEntity::GridType& grid, - const typename GridEntity::GridType::IndexType& entityIndex ) - { - neighbourEntities.refresh( grid, entityIndex ); - } - - protected: - - NeighbourEntityGetterType neighbourEntities; -}; - -template< typename GridEntity, - int NeighbourEntityDimensions, - typename GridEntityConfig > -class NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions, GridEntityConfig, false > -: public NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1, GridEntityConfig > -{ - public: - - typedef NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1, GridEntityConfig > BaseType; - typedef NeighbourGridEntityGetter< GridEntity, NeighbourEntityDimensions > NeighbourEntityGetterType; - - using BaseType::getNeighbourEntities; - - __cuda_callable__ - NeighbourGridEntityLayer( const GridEntity& entity ) - : BaseType( entity ) - {} - - __cuda_callable__ - const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< NeighbourEntityDimensions >& tag ) const {} - - __cuda_callable__ - void refresh( const typename GridEntity::GridType& grid, - const typename GridEntity::GridType::IndexType& entityIndex ) {} -}; - -template< typename GridEntity, - typename GridEntityConfig > -class NeighbourGridEntityLayer< GridEntity, 0, GridEntityConfig, false > -{ - public: - - typedef NeighbourGridEntityGetter< GridEntity, 0 > NeighbourEntityGetterType; - - __cuda_callable__ - NeighbourGridEntityLayer( const GridEntity& entity ){} - - __cuda_callable__ - const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< 0 >& tag ) const {} - - __cuda_callable__ - void refresh( const typename GridEntity::GridType& grid, - const typename GridEntity::GridType::IndexType& entityIndex ) {} -}; - - - - -template< typename GridEntity, - typename GridEntityConfig > -class NeighbourGridEntitiesStorage -: public NeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions, GridEntityConfig > -{ - typedef NeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions, GridEntityConfig > BaseType; - - public: - - using BaseType::getNeighbourEntities; - using BaseType::refresh; - - __cuda_callable__ - NeighbourGridEntitiesStorage( const GridEntity& entity ) - : BaseType( entity ) - {} - - template< int EntityDimensions > - __cuda_callable__ - const NeighbourGridEntityGetter< GridEntity, EntityDimensions >& - getNeighbourEntities() const - { - return BaseType::getNeighbourEntities( MeshDimensionsTag< EntityDimensions >() ); - } -}; - - -} // namespace Meshes -} // namespace TNL - diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h b/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h index 9abc83b529dc3a7f19a55825737c19ff54a549e1..ce571abac7da7b0460fdd7e70f451b91fb15d4ec 100644 --- a/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h +++ b/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h @@ -32,7 +32,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary cells */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true >( gridPointer, @@ -55,7 +55,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior cells */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -79,7 +79,7 @@ processAllEntities( /**** * All cells */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -105,7 +105,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true >( gridPointer, @@ -128,7 +128,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -152,7 +152,7 @@ processAllEntities( /**** * All vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h b/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h index 4b57a2642165f3b0804a23d5cc09e83356f307a7..0cb38fa1c857b40b517f4e60f5121ec9c9b495a4 100644 --- a/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h +++ b/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h @@ -32,7 +32,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary cells */ - static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 2, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1 >( gridPointer, @@ -56,7 +56,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior cells */ - static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 2, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -80,7 +80,7 @@ processAllEntities( const GridPointer& gridPointer, /**** * All cells */ - static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 2, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -107,7 +107,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary faces */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, CoordinatesType, CoordinatesType >( gridPointer, @@ -142,7 +142,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior faces */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >( gridPointer, @@ -177,7 +177,7 @@ processAllEntities( const GridPointer& gridPointer, /**** * All faces */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >( gridPointer, @@ -212,7 +212,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1 >( gridPointer, @@ -236,7 +236,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -260,7 +260,7 @@ processAllEntities( const GridPointer& gridPointer, /**** * All vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h b/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h index 42e16f64f75ca6096966e0c50d41d5f9bd252090..5f98a59d55855099162f70718ef4d75f3e8f9107 100644 --- a/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h +++ b/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h @@ -32,7 +32,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary cells */ - static_assert( GridEntity::entityDimensions == 3, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 3, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1, 1 >( gridPointer, @@ -56,7 +56,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior cells */ - static_assert( GridEntity::entityDimensions == 3, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 3, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -80,7 +80,7 @@ processAllEntities( const GridPointer& gridPointer, /**** * All cells */ - static_assert( GridEntity::entityDimensions == 3, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 3, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -107,7 +107,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary faces */ - static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 2, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, 0, CoordinatesType, CoordinatesType >( gridPointer, @@ -151,7 +151,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior faces */ - static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 2, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >( gridPointer, @@ -195,7 +195,7 @@ processAllEntities( const GridPointer& gridPointer, /**** * All faces */ - static_assert( GridEntity::entityDimensions == 2, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 2, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >( gridPointer, CoordinatesType( 0, 0, 0 ), @@ -241,7 +241,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary edges */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, 1, CoordinatesType, CoordinatesType >( gridPointer, @@ -285,7 +285,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior edges */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >( gridPointer, @@ -329,7 +329,7 @@ processAllEntities( const GridPointer& gridPointer, /**** * All edges */ - static_assert( GridEntity::entityDimensions == 1, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 1, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >( gridPointer, CoordinatesType( 0, 0, 0 ), @@ -375,7 +375,7 @@ processBoundaryEntities( const GridPointer& gridPointer, /**** * Boundary vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1, 1 >( gridPointer, @@ -399,7 +399,7 @@ processInteriorEntities( const GridPointer& gridPointer, /**** * Interior vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, @@ -423,7 +423,7 @@ processAllEntities( const GridPointer& gridPointer, /**** * All vertices */ - static_assert( GridEntity::entityDimensions == 0, "The entity has wrong dimensions." ); + static_assert( GridEntity::entityDimension == 0, "The entity has wrong dimensions." ); GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >( gridPointer, diff --git a/src/TNL/Meshes/GridEntity.h b/src/TNL/Meshes/GridEntity.h index aa70096e36a3749deb73838ea312c74e34fdd432..9afcb2e26a77117568d726d09fb080d18e97ae2a 100644 --- a/src/TNL/Meshes/GridEntity.h +++ b/src/TNL/Meshes/GridEntity.h @@ -10,15 +10,15 @@ #pragma once -#include <TNL/Meshes/GridDetails/NeighbourGridEntitiesStorage.h> +#include <TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h> namespace TNL { namespace Meshes { template< typename GridEntity, - int NeighbourEntityDimensions, + int NeighborEntityDimension, typename StencilStorage > -class NeighbourGridEntityGetter; +class NeighborGridEntityGetter; template< typename GridEntityType > class BoundaryGridEntityChecker; @@ -28,51 +28,51 @@ class GridEntityCenterGetter; template< typename Grid, - int EntityDimensions, + int EntityDimension, typename Config > class GridEntity { }; -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions, + int EntityDimension, typename Config > -class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions, Config > +class GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config > { public: - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; typedef GridType MeshType; typedef typename GridType::RealType RealType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; typedef Config ConfigType; - static const int meshDimensions = GridType::meshDimensions; + static const int meshDimension = GridType::meshDimension; - static const int entityDimensions = EntityDimensions; + static const int entityDimension = EntityDimension; - constexpr static int getDimensions() { return EntityDimensions; }; + constexpr static int getDimension() { return EntityDimension; }; - constexpr static int getMeshDimensions() { return meshDimensions; }; + constexpr static int getMeshDimension() { return meshDimension; }; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityOrientationType; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityBasisType; - typedef GridEntity< GridType, entityDimensions, Config > ThisType; - typedef typename GridType::VertexType VertexType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityOrientationType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityBasisType; + typedef GridEntity< GridType, entityDimension, Config > ThisType; + typedef typename GridType::PointType PointType; - typedef NeighbourGridEntitiesStorage< ThisType, Config > NeighbourGridEntitiesStorageType; + typedef NeighborGridEntitiesStorage< ThisType, Config > NeighborGridEntitiesStorageType; - template< int NeighbourEntityDimensions = entityDimensions > - using NeighbourEntities = - NeighbourGridEntityGetter< - GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, - EntityDimensions, + template< int NeighborEntityDimension = entityDimension > + using NeighborEntities = + NeighborGridEntityGetter< + GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, + EntityDimension, Config >, - NeighbourEntityDimensions >; + NeighborEntityDimension >; __cuda_callable__ inline GridEntity( const GridType& grid ); @@ -116,16 +116,16 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensi __cuda_callable__ inline void setBasis( const EntityBasisType& basis ); - template< int NeighbourEntityDimensions = entityDimensions > + template< int NeighborEntityDimension = entityDimension > __cuda_callable__ inline - const NeighbourEntities< NeighbourEntityDimensions >& - getNeighbourEntities() const; + const NeighborEntities< NeighborEntityDimension >& + getNeighborEntities() const; __cuda_callable__ inline bool isBoundaryEntity() const; __cuda_callable__ inline - VertexType getCenter() const; + PointType getCenter() const; __cuda_callable__ inline const RealType& getMeasure() const; @@ -145,7 +145,7 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensi EntityBasisType basis; - NeighbourGridEntitiesStorageType neighbourEntitiesStorage; + NeighborGridEntitiesStorageType neighborEntitiesStorage; //__cuda_callable__ inline //GridEntity(); @@ -158,44 +158,44 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensi /**** * Specializations for cells */ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > -class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config > +class GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config > { public: - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; typedef GridType MeshType; typedef typename GridType::RealType RealType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; typedef Config ConfigType; - static const int meshDimensions = GridType::meshDimensions; + static const int meshDimension = GridType::meshDimension; - static const int entityDimensions = meshDimensions; + static const int entityDimension = meshDimension; - constexpr static int getDimensions() { return entityDimensions; }; + constexpr static int getDimension() { return entityDimension; }; - constexpr static int getMeshDimensions() { return meshDimensions; }; + constexpr static int getMeshDimension() { return meshDimension; }; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityOrientationType; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityBasisType; - typedef GridEntity< GridType, entityDimensions, Config > ThisType; - typedef NeighbourGridEntitiesStorage< ThisType, Config > NeighbourGridEntitiesStorageType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityOrientationType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityBasisType; + typedef GridEntity< GridType, entityDimension, Config > ThisType; + typedef NeighborGridEntitiesStorage< ThisType, Config > NeighborGridEntitiesStorageType; - template< int NeighbourEntityDimensions = entityDimensions > - using NeighbourEntities = - NeighbourGridEntityGetter< - GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, - entityDimensions, + template< int NeighborEntityDimension = entityDimension > + using NeighborEntities = + NeighborGridEntityGetter< + GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, + entityDimension, Config >, - NeighbourEntityDimensions >; + NeighborEntityDimension >; __cuda_callable__ inline @@ -240,22 +240,22 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, C __cuda_callable__ inline void setBasis( const EntityBasisType& basis ){}; - template< int NeighbourEntityDimensions = Dimensions > + template< int NeighborEntityDimension = Dimension > __cuda_callable__ inline - const NeighbourEntities< NeighbourEntityDimensions >& - getNeighbourEntities() const; + const NeighborEntities< NeighborEntityDimension >& + getNeighborEntities() const; __cuda_callable__ inline bool isBoundaryEntity() const; __cuda_callable__ inline - VertexType getCenter() const; + PointType getCenter() const; __cuda_callable__ inline const RealType& getMeasure() const; __cuda_callable__ inline - const VertexType& getEntityProportions() const; + const PointType& getEntityProportions() const; __cuda_callable__ inline const GridType& getMesh() const; @@ -268,7 +268,7 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, C CoordinatesType coordinates; - NeighbourGridEntitiesStorageType neighbourEntitiesStorage; + NeighborGridEntitiesStorageType neighborEntitiesStorage; //__cuda_callable__ inline //GridEntity(); @@ -281,43 +281,43 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, C /**** * Specialization for vertices */ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > -class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config > +class GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config > { public: - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; typedef GridType MeshType; typedef typename GridType::RealType RealType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; typedef Config ConfigType; - static const int meshDimensions = GridType::meshDimensions; + static const int meshDimension = GridType::meshDimension; - static const int entityDimensions = 0; + static const int entityDimension = 0; - constexpr static int getDimensions() { return entityDimensions; }; + constexpr static int getDimension() { return entityDimension; }; - constexpr static int getMeshDimensions() { return meshDimensions; }; + constexpr static int getMeshDimension() { return meshDimension; }; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityOrientationType; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityBasisType; - typedef GridEntity< GridType, entityDimensions, Config > ThisType; - typedef NeighbourGridEntitiesStorage< ThisType, Config > NeighbourGridEntitiesStorageType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityOrientationType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityBasisType; + typedef GridEntity< GridType, entityDimension, Config > ThisType; + typedef NeighborGridEntitiesStorage< ThisType, Config > NeighborGridEntitiesStorageType; - template< int NeighbourEntityDimensions = entityDimensions > - using NeighbourEntities = - NeighbourGridEntityGetter< - GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, - entityDimensions, + template< int NeighborEntityDimension = entityDimension > + using NeighborEntities = + NeighborGridEntityGetter< + GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, + entityDimension, Config >, - NeighbourEntityDimensions >; + NeighborEntityDimension >; __cuda_callable__ inline @@ -363,22 +363,22 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config > void setBasis( const EntityBasisType& basis ){}; - template< int NeighbourEntityDimensions = entityDimensions > + template< int NeighborEntityDimension = entityDimension > __cuda_callable__ inline - const NeighbourEntities< NeighbourEntityDimensions >& - getNeighbourEntities() const; + const NeighborEntities< NeighborEntityDimension >& + getNeighborEntities() const; __cuda_callable__ inline bool isBoundaryEntity() const; __cuda_callable__ inline - VertexType getCenter() const; + PointType getCenter() const; __cuda_callable__ inline const RealType getMeasure() const; __cuda_callable__ inline - VertexType getEntityProportions() const; + PointType getEntityProportions() const; __cuda_callable__ inline const GridType& getMesh() const; @@ -391,7 +391,7 @@ class GridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, 0, Config > CoordinatesType coordinates; - NeighbourGridEntitiesStorageType neighbourEntitiesStorage; + NeighborGridEntitiesStorageType neighborEntitiesStorage; friend class BoundaryGridEntityChecker< ThisType >; diff --git a/src/TNL/Meshes/GridEntityConfig.h b/src/TNL/Meshes/GridEntityConfig.h index 89b45f649137d02a78481a3762e15c40c0c6dfd0..8c30a7bbaadc11efbb8c089d92a350ee66e2282d 100644 --- a/src/TNL/Meshes/GridEntityConfig.h +++ b/src/TNL/Meshes/GridEntityConfig.h @@ -29,9 +29,9 @@ class GridEntityStencilStorageTag }; /**** - * This class says what neighbour grid entity indexes shall be pre-computed and stored in the - * grid entity structure. If neighbourEntityStorage() returns false, nothing is stored. - * Otherwise, if neighbour entity storage is enabled, we may store either only neighbour entities in a cross like this + * This class says what neighbor grid entity indexes shall be pre-computed and stored in the + * grid entity structure. If neighborEntityStorage() returns false, nothing is stored. + * Otherwise, if neighbor entity storage is enabled, we may store either only neighbor entities in a cross like this * * X * X X @@ -39,7 +39,7 @@ class GridEntityStencilStorageTag * X X * X * - * or all neighbour entities like this + * or all neighbor entities like this * * XXXXX * XXX XXXXX @@ -53,7 +53,7 @@ class GridEntityNoStencilStorage public: template< typename GridEntity > - constexpr static bool neighbourEntityStorage( int neighbourEntityStorage ) + constexpr static bool neighborEntityStorage( int neighborEntityStorage ) { return false; } @@ -70,10 +70,10 @@ class GridEntityCrossStencilStorage public: template< typename GridEntity > - constexpr static bool neighbourEntityStorage( const int neighbourEntityDimensions ) + constexpr static bool neighborEntityStorage( const int neighborEntityDimension ) { - return ( GridEntity::entityDimensions == GridEntity::GridType::meshDimensions && - neighbourEntityDimensions == GridEntity::GridType::meshDimensions ) + return ( GridEntity::entityDimension == GridEntity::GridType::meshDimension && + neighborEntityDimension == GridEntity::GridType::meshDimension ) // FIXME: how is GridEntityCrossStencil cast to int? * GridEntityCrossStencil; } diff --git a/src/TNL/Meshes/Mesh.h b/src/TNL/Meshes/Mesh.h index b04c0af49a1d2e30891ee46710bfced1ce69a96f..47060304a5072def2801b54990df03a54c368e24 100644 --- a/src/TNL/Meshes/Mesh.h +++ b/src/TNL/Meshes/Mesh.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <ostream> @@ -36,34 +42,34 @@ class Mesh : public Object/*, typedef typename MeshTraitsType::CellType CellType; typedef typename MeshTraitsType::VertexType VertexType; typedef typename MeshTraitsType::PointType PointType; - static const int dimensions = MeshTraitsType::meshDimensions; - template< int Dimensions > using EntityTraits = typename MeshTraitsType::template EntityTraits< Dimensions >; - template< int Dimensions > using EntityType = typename EntityTraits< Dimensions >::EntityType; + static const int dimension = MeshTraitsType::meshDimension; + template< int Dimension > using EntityTraits = typename MeshTraitsType::template EntityTraits< Dimension >; + template< int Dimension > using EntityType = typename EntityTraits< Dimension >::EntityType; static String getType(); virtual String getTypeVirtual() const; - static constexpr int getDimensions(); + static constexpr int getMeshDimension(); - template< int Dimensions > + template< int Dimension > bool entitiesAvalable() const; GlobalIndexType getNumberOfCells() const; // TODO: rename to getEntitiesCount - template< int Dimensions > + template< int Dimension > GlobalIndexType getNumberOfEntities() const; CellType& getCell( const GlobalIndexType entityIndex ); const CellType& getCell( const GlobalIndexType entityIndex ) const; - template< int Dimensions > - EntityType< Dimensions >& getEntity( const GlobalIndexType entityIndex ); + template< int Dimension > + EntityType< Dimension >& getEntity( const GlobalIndexType entityIndex ); - template< int Dimensions > - const EntityType< Dimensions >& getEntity( const GlobalIndexType entityIndex ) const; + template< int Dimension > + const EntityType< Dimension >& getEntity( const GlobalIndexType entityIndex ) const; bool save( File& file ) const; @@ -77,18 +83,18 @@ class Mesh : public Object/*, bool operator==( const Mesh& mesh ) const; // TODO: this is only for mesh intializer - remove it if possible - template< typename DimensionsTag > - typename EntityTraits< DimensionsTag::value >::StorageArrayType& entitiesArray(); + template< typename DimensionTag > + typename EntityTraits< DimensionTag::value >::StorageArrayType& entitiesArray(); - template< typename DimensionsTag, typename SuperDimensionsTag > + template< typename DimensionTag, typename SuperDimensionTag > typename MeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray(); template< typename EntityTopology, typename SuperdimensionsTag > typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType& getSuperentityStorageNetwork() { - return entitiesStorage.template getSuperentityStorageNetwork< SuperdimensionsTag >( MeshDimensionsTag< EntityTopology::dimensions >() ); + return entitiesStorage.template getSuperentityStorageNetwork< SuperdimensionsTag >( MeshDimensionTag< EntityTopology::dimensions >() ); } bool init( const typename MeshTraitsType::PointArrayType& points, diff --git a/src/TNL/Meshes/MeshBuilder.h b/src/TNL/Meshes/MeshBuilder.h index 2eac2aa8b717868d19bbee442a6755d49727ee47..cfa5058a280edadcfa489b971f9dbbac9e2ada98 100644 --- a/src/TNL/Meshes/MeshBuilder.h +++ b/src/TNL/Meshes/MeshBuilder.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> diff --git a/src/TNL/Meshes/MeshConfigBase.h b/src/TNL/Meshes/MeshConfigBase.h index 78b047cbab1cebc8f754c211901bb6b8dbe665fa..523afce5b6d84824632eb1b9fd9d01c35ea2ffcb 100644 --- a/src/TNL/Meshes/MeshConfigBase.h +++ b/src/TNL/Meshes/MeshConfigBase.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { @@ -20,7 +26,7 @@ namespace Meshes { * mesh storage layer. */ template< typename Cell, - int WorldDimensions = Cell::dimensions, + int WorldDimension = Cell::dimensions, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex, @@ -33,8 +39,8 @@ struct MeshConfigBase typedef LocalIndex LocalIndexType; typedef Id IdType; - static const int worldDimensions = WorldDimensions; - static const int meshDimensions = Cell::dimensions; + static const int worldDimension = WorldDimension; + static const int meshDimension = Cell::dimensions; static String getType() { @@ -50,20 +56,20 @@ struct MeshConfigBase * Vertices and cells must always be stored */ return true; - //return ( dimensions == 0 || dimensions == cellDimensions ); + //return ( dimensions == 0 || dimensions == cellDimension ); } /**** * Storage of subentities of mesh entities */ template< typename MeshEntity > - static constexpr bool subentityStorage( MeshEntity, int SubentityDimensions ) + static constexpr bool subentityStorage( MeshEntity, int SubentityDimension ) { /**** * Vertices must always be stored */ return true; - //return ( SubentityDimensions == 0 ); + //return ( SubentityDimension == 0 ); } /**** @@ -71,22 +77,22 @@ struct MeshConfigBase * It must be false for vertices and cells. */ template< typename MeshEntity > - static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) + static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimension ) { - return ( SubentityDimensions > 0 ); + return ( SubentityDimension > 0 ); } /**** * Storage of superentities of mesh entities */ template< typename MeshEntity > - static constexpr bool superentityStorage( MeshEntity, int SuperentityDimensions ) + static constexpr bool superentityStorage( MeshEntity, int SuperentityDimension ) { return true; //return false; } - static_assert( WorldDimensions >= Cell::dimensions, "The number of the cell dimensions cannot be larger than the world dimension." ); + static_assert( WorldDimension >= Cell::dimensions, "The number of the cell dimensions cannot be larger than the world dimension." ); }; } // namespace Meshes diff --git a/src/TNL/Meshes/MeshDetails/MeshEntityId.h b/src/TNL/Meshes/MeshDetails/MeshEntityId.h index d3aa829b7d669830d947992e076e5c2a0e252590..c514b1b09d86d25998851de8779772d871439766 100644 --- a/src/TNL/Meshes/MeshDetails/MeshEntityId.h +++ b/src/TNL/Meshes/MeshDetails/MeshEntityId.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { diff --git a/src/TNL/Meshes/MeshDetails/MeshEntityIntegrityChecker.h b/src/TNL/Meshes/MeshDetails/MeshEntityIntegrityChecker.h index 3cb41850e52b93f8b290932bd4b3318f0fe363a0..2eabfa69e9e72a2b9e3a96aa4c8a3d11d87eaa19 100644 --- a/src/TNL/Meshes/MeshDetails/MeshEntityIntegrityChecker.h +++ b/src/TNL/Meshes/MeshDetails/MeshEntityIntegrityChecker.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { diff --git a/src/TNL/Meshes/MeshDetails/MeshEntityOrientation.h b/src/TNL/Meshes/MeshDetails/MeshEntityOrientation.h index 3d96ec68c643da0a464f470245a08c0521bc9b00..f497c6306015e97aa60a00728e1153770b94ded1 100644 --- a/src/TNL/Meshes/MeshDetails/MeshEntityOrientation.h +++ b/src/TNL/Meshes/MeshDetails/MeshEntityOrientation.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> diff --git a/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h b/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h index 335923a49cdf5d79d7fe9627ae9e7653446552e0..bad26901bc0cdbfb1366ea28eecf34103c82e745 100644 --- a/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h +++ b/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { diff --git a/src/TNL/Meshes/MeshDetails/MeshEntity_impl.h b/src/TNL/Meshes/MeshDetails/MeshEntity_impl.h index fe533414aa505d28681402e7bdf450e156222a89..9e9ff9b8aac46c8434d00b55c4b9361bcdcecc4d 100644 --- a/src/TNL/Meshes/MeshDetails/MeshEntity_impl.h +++ b/src/TNL/Meshes/MeshDetails/MeshEntity_impl.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/MeshEntity.h> @@ -89,7 +95,7 @@ void MeshEntity< MeshConfig, EntityTopology >:: print( std::ostream& str ) const { - str << "\t Mesh entity dimensions: " << EntityTopology::dimensions << std::endl; + str << "\t Mesh entity dimension: " << EntityTopology::dimensions << std::endl; MeshSubentityStorageLayers< MeshConfig, EntityTopology >::print( str ); MeshSuperentityAccess< MeshConfig, EntityTopology >::print( str ); } @@ -110,7 +116,7 @@ template< typename MeshConfig, typename EntityTopology > constexpr int MeshEntity< MeshConfig, EntityTopology >:: -getEntityDimensions() const +getEntityDimension() const { return EntityTopology::dimensions; } @@ -152,7 +158,7 @@ getSubentityIndex( const LocalIndexType localIndex) const << " subentitiesCount = " << SubentityTraits< Subdimensions >::count ); typedef MeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - return SubentityBaseType::getSubentityIndex( MeshDimensionsTag< Subdimensions >(), + return SubentityBaseType::getSubentityIndex( MeshDimensionTag< Subdimensions >(), localIndex ); } @@ -165,7 +171,7 @@ MeshEntity< MeshConfig, EntityTopology >:: { static_assert( SubentityTraits< Subdimensions >::storageEnabled, "You try to get subentities which are not configured for storage." ); typedef MeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - return SubentityBaseType::getSubentitiesIndices( MeshDimensionsTag< Subdimensions >() ); + return SubentityBaseType::getSubentitiesIndices( MeshDimensionTag< Subdimensions >() ); } template< typename MeshConfig, @@ -177,59 +183,59 @@ getSubentitiesIndices() const { static_assert( SubentityTraits< Subdimensions >::storageEnabled, "You try to set subentities which are not configured for storage." ); typedef MeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - return SubentityBaseType::getSubentitiesIndices( MeshDimensionsTag< Subdimensions >() ); + return SubentityBaseType::getSubentitiesIndices( MeshDimensionTag< Subdimensions >() ); } template< typename MeshConfig, typename EntityTopology > - template< int SuperDimensions > + template< int SuperDimension > typename MeshEntity< MeshConfig, EntityTopology >::LocalIndexType MeshEntity< MeshConfig, EntityTopology >:: getNumberOfSuperentities() const { - static_assert( SuperentityTraits< SuperDimensions >::available, "You try to get number of superentities which are not configured for storage." ); + static_assert( SuperentityTraits< SuperDimension >::available, "You try to get number of superentities which are not configured for storage." ); typedef MeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - return SuperentityBaseType::getNumberOfSuperentities( MeshDimensionsTag< SuperDimensions >() ); + return SuperentityBaseType::getNumberOfSuperentities( MeshDimensionTag< SuperDimension >() ); } template< typename MeshConfig, typename EntityTopology > - template< int SuperDimensions > + template< int SuperDimension > typename MeshEntity< MeshConfig, EntityTopology >::GlobalIndexType MeshEntity< MeshConfig, EntityTopology >:: getSuperentityIndex( const LocalIndexType localIndex ) const { - static_assert( SuperentityTraits< SuperDimensions >::storageEnabled, "You try to get superentity which is not configured for storage." ); - TNL_ASSERT( localIndex < this->getNumberOfSuperentities< SuperDimensions >(), + static_assert( SuperentityTraits< SuperDimension >::storageEnabled, "You try to get superentity which is not configured for storage." ); + TNL_ASSERT( localIndex < this->getNumberOfSuperentities< SuperDimension >(), std::cerr << " localIndex = " << localIndex - << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< SuperDimensions >() << std::endl; ); + << " this->getNumberOfSuperentities< Dimension >() = " << this->getNumberOfSuperentities< SuperDimension >() << std::endl; ); typedef MeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - return SuperentityBaseType::getSuperentityIndex( MeshDimensionsTag< SuperDimensions >(), + return SuperentityBaseType::getSuperentityIndex( MeshDimensionTag< SuperDimension >(), localIndex ); } template< typename MeshConfig, typename EntityTopology > - template< int SuperDimensions > -typename MeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimensions >::AccessArrayType& + template< int SuperDimension > +typename MeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimension >::AccessArrayType& MeshEntity< MeshConfig, EntityTopology >:: getSuperentitiesIndices() { - static_assert( SuperentityTraits< SuperDimensions >::storageEnabled, "You try to get superentities which are not configured for storage." ); + static_assert( SuperentityTraits< SuperDimension >::storageEnabled, "You try to get superentities which are not configured for storage." ); typedef MeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - //return SuperentityBaseType::getSuperentitiesIndices( MeshDimensionsTag< Dimensions >() ); + //return SuperentityBaseType::getSuperentitiesIndices( MeshDimensionTag< Dimension >() ); } template< typename MeshConfig, typename EntityTopology > - template< int SuperDimensions > -const typename MeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimensions >::AccessArrayType& + template< int SuperDimension > +const typename MeshEntity< MeshConfig, EntityTopology >::template SuperentityTraits< SuperDimension >::AccessArrayType& MeshEntity< MeshConfig, EntityTopology >:: getSuperentitiesIndices() const { - static_assert( SuperentityTraits< SuperDimensions >::storageEnabled, "You try to get superentities which are not configured for storage." ); + static_assert( SuperentityTraits< SuperDimension >::storageEnabled, "You try to get superentities which are not configured for storage." ); typedef MeshSuperentityAccess< MeshConfig, EntityTopology > SuperentityBaseType; - return SuperentityBaseType::getSubentitiesIndices( MeshDimensionsTag< SuperDimensions >() ); + return SuperentityBaseType::getSubentitiesIndices( MeshDimensionTag< SuperDimension >() ); } template< typename MeshConfig, @@ -270,15 +276,15 @@ getVerticesIndices() const template< typename MeshConfig, typename EntityTopology > - template< int Dimensions > + template< int Dimension > typename MeshEntity< MeshConfig, EntityTopology >::IdPermutationArrayAccessorType MeshEntity< MeshConfig, EntityTopology >:: subentityOrientation( LocalIndexType index ) const { - static const LocalIndexType subentitiesCount = SubentityTraits< Dimensions >::count; + static const LocalIndexType subentitiesCount = SubentityTraits< Dimension >::count; TNL_ASSERT( 0 <= index && index < subentitiesCount, ); - return SubentityStorageLayers::subentityOrientation( MeshDimensionsTag< Dimensions >(), index ); + return SubentityStorageLayers::subentityOrientation( MeshDimensionTag< Dimension >(), index ); } /**** @@ -300,7 +306,7 @@ setSubentityIndex( const LocalIndexType localIndex, << " subentitiesCount = " << SubentityTraits< Subdimensions >::count ); typedef MeshSubentityStorageLayers< MeshConfig, EntityTopology > SubentityBaseType; - SubentityBaseType::setSubentityIndex( MeshDimensionsTag< Subdimensions >(), + SubentityBaseType::setSubentityIndex( MeshDimensionTag< Subdimensions >(), localIndex, globalIndex ); } @@ -312,7 +318,7 @@ typename MeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< Sub MeshEntity< MeshConfig, EntityTopology >:: subentityIdsArray() { - return SubentityStorageLayers::subentityIdsArray( MeshDimensionsTag< Subdimensions >() ); + return SubentityStorageLayers::subentityIdsArray( MeshDimensionTag< Subdimensions >() ); } template< typename MeshConfig, @@ -322,7 +328,7 @@ typename MeshEntity< MeshConfig, EntityTopology >::IdArrayAccessorType& MeshEntity< MeshConfig, EntityTopology >:: superentityIdsArray() { - return SuperentityAccessBase::superentityIdsArray( MeshDimensionsTag< Superdimensions >()); + return SuperentityAccessBase::superentityIdsArray( MeshDimensionTag< Superdimensions >()); } template< typename MeshConfig, @@ -332,7 +338,7 @@ typename MeshEntity< MeshConfig, EntityTopology >::template SubentityTraits< Sub MeshEntity< MeshConfig, EntityTopology >:: subentityOrientationsArray() { - return SubentityStorageLayers::subentityOrientationsArray( MeshDimensionsTag< Subdimensions >() ); + return SubentityStorageLayers::subentityOrientationsArray( MeshDimensionTag< Subdimensions >() ); } /**** @@ -388,7 +394,7 @@ void MeshEntity< MeshConfig, MeshVertexTopology >:: print( std::ostream& str ) const { - str << "\t Mesh entity dimensions: " << MeshVertexTopology::dimensions << std::endl; + str << "\t Mesh entity dimension: " << MeshVertexTopology::dimensions << std::endl; str << "\t Coordinates = ( " << point << " )"; MeshSuperentityAccess< MeshConfig, MeshVertexTopology >::print( str ); } @@ -407,7 +413,7 @@ operator==( const MeshEntity& entity ) const template< typename MeshConfig > constexpr int MeshEntity< MeshConfig, MeshVertexTopology >:: -getEntityDimensions() const +getEntityDimension() const { return EntityTopology::dimensions; } @@ -419,7 +425,7 @@ MeshEntity< MeshConfig, MeshVertexTopology >:: getNumberOfSuperentities() const { typedef MeshSuperentityAccess< MeshConfig, MeshVertexTopology > SuperentityBaseType; - return SuperentityBaseType::getNumberOfSuperentities( MeshDimensionsTag< Superdimensions >() ); + return SuperentityBaseType::getNumberOfSuperentities( MeshDimensionTag< Superdimensions >() ); } template< typename MeshConfig > @@ -429,7 +435,7 @@ MeshEntity< MeshConfig, MeshVertexTopology >:: getSuperentitiesIndices() { typedef MeshSuperentityAccess< MeshConfig, MeshVertexTopology > SuperentityBaseType; - return SuperentityBaseType::getSuperentitiesIndices( MeshDimensionsTag< Superdimensions >() ); + return SuperentityBaseType::getSuperentitiesIndices( MeshDimensionTag< Superdimensions >() ); } template< typename MeshConfig > @@ -439,20 +445,20 @@ MeshEntity< MeshConfig, MeshVertexTopology >:: getSuperentitiesIndeces() const { typedef MeshSuperentityAccess< MeshConfig, MeshVertexTopology > SuperentityBaseType; - return SuperentityBaseType::getSubentitiesIndices( MeshDimensionsTag< Superdimensions >() ); + return SuperentityBaseType::getSubentitiesIndices( MeshDimensionTag< Superdimensions >() ); } template< typename MeshConfig > - template< int Dimensions > + template< int Dimension > typename MeshEntity< MeshConfig, MeshVertexTopology >::GlobalIndexType MeshEntity< MeshConfig, MeshVertexTopology >:: getSuperentityIndex( const LocalIndexType localIndex ) const { - TNL_ASSERT( localIndex < this->getNumberOfSuperentities< Dimensions >(), + TNL_ASSERT( localIndex < this->getNumberOfSuperentities< Dimension >(), std::cerr << " localIndex = " << localIndex - << " this->getNumberOfSuperentities< Dimensions >() = " << this->getNumberOfSuperentities< Dimensions >() << std::endl; ); + << " this->getNumberOfSuperentities< Dimension >() = " << this->getNumberOfSuperentities< Dimension >() << std::endl; ); typedef MeshSuperentityAccess< MeshConfig, MeshVertexTopology > SuperentityBaseType; - return SuperentityBaseType::getSuperentityIndex( MeshDimensionsTag< Dimensions >(), + return SuperentityBaseType::getSuperentityIndex( MeshDimensionTag< Dimension >(), localIndex ); } @@ -478,7 +484,7 @@ typename MeshEntity< MeshConfig, MeshVertexTopology >::MeshTraitsType::IdArrayAc MeshEntity< MeshConfig, MeshVertexTopology >:: superentityIdsArray() { - return SuperentityAccessBase::superentityIdsArray( MeshDimensionsTag< Superdimensions >()); + return SuperentityAccessBase::superentityIdsArray( MeshDimensionTag< Superdimensions >()); } template< typename MeshConfig, diff --git a/src/TNL/Meshes/MeshDetails/MeshIntegrityChecker.h b/src/TNL/Meshes/MeshDetails/MeshIntegrityChecker.h index 71c0a106835d0dbbf0159ca76aedf781fe346582..42ddaa1d2dded36a364bcdafe3ab66828be45c61 100644 --- a/src/TNL/Meshes/MeshDetails/MeshIntegrityChecker.h +++ b/src/TNL/Meshes/MeshDetails/MeshIntegrityChecker.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/Mesh.h> @@ -19,10 +25,10 @@ namespace Meshes { template< typename MeshType > class MeshIntegrityChecker : public MeshIntegrityCheckerLayer< MeshType, - MeshDimensionsTag< MeshType::Config::CellType::dimensions > > + MeshDimensionTag< MeshType::Config::CellType::dimensions > > { - typedef MeshDimensionsTag< MeshType::Config::CellType::dimensions > DimensionsTag; - typedef MeshIntegrityCheckerLayer< MeshType, DimensionsTag > BaseType; + typedef MeshDimensionTag< MeshType::Config::CellType::dimensions > DimensionTag; + typedef MeshIntegrityCheckerLayer< MeshType, DimensionTag > BaseType; public: static bool checkMesh( const MeshType& mesh ) diff --git a/src/TNL/Meshes/MeshDetails/MeshIntegrityCheckerLayer.h b/src/TNL/Meshes/MeshDetails/MeshIntegrityCheckerLayer.h index 8ce8d050a7f7f603aba5260103e5d12da1de4ee4..302ed0b05ad395eb1fdf4d1a26228c49f5bdfbad 100644 --- a/src/TNL/Meshes/MeshDetails/MeshIntegrityCheckerLayer.h +++ b/src/TNL/Meshes/MeshDetails/MeshIntegrityCheckerLayer.h @@ -8,32 +8,38 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h> -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> namespace TNL { namespace Meshes { template< typename MeshType, - typename DimensionsTag, + typename DimensionTag, bool EntityStorageTag = MeshEntityTraits< typename MeshType::Config, - DimensionsTag::value >::storageEnabled > + DimensionTag::value >::storageEnabled > class MeshIntegrityCheckerLayer; template< typename MeshType, - typename DimensionsTag > + typename DimensionTag > class MeshIntegrityCheckerLayer< MeshType, - DimensionsTag, + DimensionTag, true > : public MeshIntegrityCheckerLayer< MeshType, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { public: typedef MeshIntegrityCheckerLayer< MeshType, - typename DimensionsTag::Decrement > BaseType; - enum { dimensions = DimensionsTag::value }; + typename DimensionTag::Decrement > BaseType; + enum { dimensions = DimensionTag::value }; static bool checkEntities( const MeshType& mesh ) { @@ -55,7 +61,7 @@ class MeshIntegrityCheckerLayer< MeshType, template< typename MeshType > class MeshIntegrityCheckerLayer< MeshType, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, true > { public: @@ -79,19 +85,19 @@ class MeshIntegrityCheckerLayer< MeshType, }; template< typename MeshType, - typename DimensionsTag > + typename DimensionTag > class MeshIntegrityCheckerLayer< MeshType, - DimensionsTag, + DimensionTag, false > : public MeshIntegrityCheckerLayer< MeshType, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { }; template< typename MeshType > class MeshIntegrityCheckerLayer< MeshType, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, false > { diff --git a/src/TNL/Meshes/MeshDetails/MeshReaderNetgen.h b/src/TNL/Meshes/MeshDetails/MeshReaderNetgen.h index 4ca58293bdeaec73512608b60bf3d9e01332df6e..d3264a480aefc1bc82a42ae3affb08f95a73e517 100644 --- a/src/TNL/Meshes/MeshDetails/MeshReaderNetgen.h +++ b/src/TNL/Meshes/MeshDetails/MeshReaderNetgen.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <fstream> @@ -225,7 +231,7 @@ class MeshReaderNetgen return true; } - int getDimensions() const + int getDimension() const { return this->dimensions; } diff --git a/src/TNL/Meshes/MeshDetails/MeshWriterNetgen.h b/src/TNL/Meshes/MeshDetails/MeshWriterNetgen.h index 757807734a02438ab1150b48cf3c1ff97ffeffef..82cbc84a24ae2b57bbac34d5b995a6a99befc627 100644 --- a/src/TNL/Meshes/MeshDetails/MeshWriterNetgen.h +++ b/src/TNL/Meshes/MeshDetails/MeshWriterNetgen.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <fstream> @@ -37,7 +43,7 @@ class MeshWriterNetgen outputFile << std::setprecision( 6 ); outputFile << fixed; - const int meshDimensions = MeshType::meshDimensions; + const int meshDimension = MeshType::meshDimension; typedef typename MeshType::template EntitiesTraits< 0 >::GlobalIndexType VerticesIndexType; typedef typename MeshType::PointType PointType; const VerticesIndexType numberOfVertices = mesh.getNumberOfVertices(); @@ -46,23 +52,23 @@ class MeshWriterNetgen { const PointType& point = mesh.getVertex( i ).getPoint(); outputFile << " "; - for( int d = 0; d < meshDimensions; d++ ) + for( int d = 0; d < meshDimension; d++ ) outputFile << " " << point[ d ]; outputFile << std::endl; } - typedef typename MeshType::template EntitiesTraits< meshDimensions >::GlobalIndexType CellIndexType; - typedef typename MeshType::template EntitiesTraits< meshDimensions >::Type CellType; + typedef typename MeshType::template EntitiesTraits< meshDimension >::GlobalIndexType CellIndexType; + typedef typename MeshType::template EntitiesTraits< meshDimension >::Type CellType; typedef typename CellType::LocalIndexType LocalIndexType; - const CellIndexType numberOfCells = mesh.template getNumberOfEntities< meshDimensions >(); + const CellIndexType numberOfCells = mesh.template getNumberOfEntities< meshDimension >(); outputFile << numberOfCells << std::endl; for( CellIndexType cellIdx = 0; cellIdx < numberOfCells; cellIdx++ ) { - const CellType& cell = mesh.template getEntity< meshDimensions >( cellIdx ); + const CellType& cell = mesh.template getEntity< meshDimension >( cellIdx ); outputFile << " 1"; for( LocalIndexType cellVertexIdx = 0; - cellVertexIdx < meshDimensions + 1; + cellVertexIdx < meshDimension + 1; cellVertexIdx++ ) outputFile << " " << cell.getVertexIndex( cellVertexIdx ); outputFile << std::endl; diff --git a/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h b/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h index ff4673a790ebfd08ecf33c93916be5b3990a5f7d..930e00e5ba977111f3b9f4adf30a00d7d2a62003 100644 --- a/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h +++ b/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <fstream> diff --git a/src/TNL/Meshes/MeshDetails/Mesh_impl.h b/src/TNL/Meshes/MeshDetails/Mesh_impl.h index cff4831ee7b50424de181f1a2d38edd07801aeaf..eb5f457a6b4449832e750ac96eecba033e173ded 100644 --- a/src/TNL/Meshes/MeshDetails/Mesh_impl.h +++ b/src/TNL/Meshes/MeshDetails/Mesh_impl.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/Mesh.h> @@ -34,27 +40,27 @@ getTypeVirtual() const template< typename MeshConfig > constexpr int Mesh< MeshConfig >:: -getDimensions() +getMeshDimension() { - return dimensions; + return dimension; } template< typename MeshConfig > - template< int Dimensions > + template< int Dimension > bool Mesh< MeshConfig >:: entitiesAvalable() const { - return MeshTraitsType::template EntityTraits< Dimensions >::available; + return MeshTraitsType::template EntityTraits< Dimension >::available; } template< typename MeshConfig > - template< int Dimensions > + template< int Dimension > typename Mesh< MeshConfig >::GlobalIndexType Mesh< MeshConfig >:: getNumberOfEntities() const { - return entitiesStorage.getNumberOfEntities( MeshDimensionsTag< Dimensions >() ); + return entitiesStorage.getNumberOfEntities( MeshDimensionTag< Dimension >() ); } template< typename MeshConfig > @@ -62,7 +68,7 @@ typename Mesh< MeshConfig >::GlobalIndexType Mesh< MeshConfig >:: template getNumberOfCells() const { - return entitiesStorage.getNumberOfEntities( MeshDimensionsTag< dimensions >() ); + return entitiesStorage.getNumberOfEntities( MeshDimensionTag< dimensions >() ); } template< typename MeshConfig > @@ -70,7 +76,7 @@ typename Mesh< MeshConfig >::CellType& Mesh< MeshConfig >:: getCell( const GlobalIndexType cellIndex ) { - return entitiesStorage.getEntity( MeshDimensionsTag< dimensions >(), cellIndex ); + return entitiesStorage.getEntity( MeshDimensionTag< dimensions >(), cellIndex ); } template< typename MeshConfig > @@ -78,25 +84,25 @@ const typename Mesh< MeshConfig >::CellType& Mesh< MeshConfig >:: getCell( const GlobalIndexType cellIndex ) const { - return entitiesStorage.getEntity( MeshDimensionsTag< dimensions >(), cellIndex ); + return entitiesStorage.getEntity( MeshDimensionTag< dimensions >(), cellIndex ); } template< typename MeshConfig > - template< int Dimensions > -typename Mesh< MeshConfig >::template EntityType< Dimensions >& + template< int Dimension > +typename Mesh< MeshConfig >::template EntityType< Dimension >& Mesh< MeshConfig >:: getEntity( const GlobalIndexType entityIndex ) { - return entitiesStorage.getEntity( MeshDimensionsTag< Dimensions >(), entityIndex ); + return entitiesStorage.getEntity( MeshDimensionTag< Dimension >(), entityIndex ); } template< typename MeshConfig > - template< int Dimensions > -const typename Mesh< MeshConfig >::template EntityType< Dimensions >& + template< int Dimension > +const typename Mesh< MeshConfig >::template EntityType< Dimension >& Mesh< MeshConfig >:: getEntity( const GlobalIndexType entityIndex ) const { - return entitiesStorage.getEntity( MeshDimensionsTag< Dimensions >(), entityIndex ); + return entitiesStorage.getEntity( MeshDimensionTag< Dimension >(), entityIndex ); } template< typename MeshConfig > @@ -144,21 +150,21 @@ operator==( const Mesh& mesh ) const } template< typename MeshConfig > - template< typename DimensionsTag > -typename Mesh< MeshConfig >::template EntityTraits< DimensionsTag::value >::StorageArrayType& + template< typename DimensionTag > +typename Mesh< MeshConfig >::template EntityTraits< DimensionTag::value >::StorageArrayType& Mesh< MeshConfig >:: entitiesArray() { - return entitiesStorage.entitiesArray( DimensionsTag() ); + return entitiesStorage.entitiesArray( DimensionTag() ); } template< typename MeshConfig > - template< typename DimensionsTag, typename SuperDimensionsTag > + template< typename DimensionTag, typename SuperDimensionTag > typename Mesh< MeshConfig >::MeshTraitsType::GlobalIdArrayType& Mesh< MeshConfig >:: superentityIdsArray() { - return entitiesStorage.template superentityIdsArray< SuperDimensionsTag >( DimensionsTag() ); + return entitiesStorage.template superentityIdsArray< SuperDimensionTag >( DimensionTag() ); } template< typename MeshConfig > diff --git a/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h b/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h index d4556a0999339e939de01dacb97364265d461ee0..ba079790e1d18079e881b4b19af4935fa68df1b6 100644 --- a/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h +++ b/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h @@ -8,11 +8,17 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Assert.h> #include <TNL/Meshes/Topologies/MeshEntityTopology.h> -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> namespace TNL { namespace Meshes { @@ -33,7 +39,7 @@ public MeshConfigValidatorSubtopologyLayer< MeshConfig, MeshEntity, typename dim template< typename MeshConfig, typename MeshEntity > -class MeshConfigValidatorSubtopologyLayer< MeshConfig, MeshEntity, MeshDimensionsTag< 0 > > +class MeshConfigValidatorSubtopologyLayer< MeshConfig, MeshEntity, MeshDimensionTag< 0 > > { static_assert( ! MeshConfig::subentityStorage( MeshEntity(), 0 ) || MeshConfig::entityStorage( 0 ), "entities that are stored as subentities must be stored" ); @@ -55,7 +61,7 @@ public MeshConfigValidatorSupertopologyLayer< MeshConfig, MeshEntity, typename d template< typename MeshConfig, typename MeshEntity > -class MeshConfigValidatorSupertopologyLayer< MeshConfig, MeshEntity, MeshDimensionsTag< MeshEntity::dimensions > > +class MeshConfigValidatorSupertopologyLayer< MeshConfig, MeshEntity, MeshDimensionTag< MeshEntity::dimensions > > {}; @@ -64,10 +70,10 @@ class MeshConfigValidatorLayer : public MeshConfigValidatorLayer< MeshConfig, dimensions - 1 >, public MeshConfigValidatorSubtopologyLayer< MeshConfig, typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology, - MeshDimensionsTag< dimensions - 1 > >, + MeshDimensionTag< dimensions - 1 > >, public MeshConfigValidatorSupertopologyLayer< MeshConfig, typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology, - MeshDimensionsTag< MeshConfig::CellTopology::dimensions > > + MeshDimensionTag< MeshConfig::CellTopology::dimensions > > { typedef typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology Topology; @@ -84,7 +90,7 @@ class MeshConfigValidatorLayerCell : public MeshConfigValidatorLayer< MeshConfig, MeshConfig::CellTopology::dimensions - 1 >, public MeshConfigValidatorSubtopologyLayer< MeshConfig, typename MeshConfig::CellTopology, - MeshDimensionsTag< MeshConfig::CellTopology::dimensions - 1 > > + MeshDimensionTag< MeshConfig::CellTopology::dimensions - 1 > > { typedef typename MeshConfig::CellTopology CellTopology; static const int dimensions = CellTopology::dimensions; @@ -95,13 +101,13 @@ class MeshConfigValidatorLayerCell : template<typename MeshConfig > class MeshConfigValidator : public MeshConfigValidatorLayerCell< MeshConfig > { - static const int meshDimensions = MeshConfig::CellTopology::dimensions; + static const int meshDimension = MeshConfig::CellTopology::dimensions; - static_assert(1 <= meshDimensions, "zero dimensional meshes are not supported"); - static_assert( meshDimensions <= MeshConfig::worldDimensions, "world dimension must not be less than mesh dimension"); + static_assert(1 <= meshDimension, "zero dimensional meshes are not supported"); + static_assert( meshDimension <= MeshConfig::worldDimension, "world dimension must not be less than mesh dimension"); static_assert( MeshConfig::entityStorage( 0 ), "mesh vertices must be stored"); - static_assert( MeshConfig::entityStorage( meshDimensions ), "mesh cells must be stored"); + static_assert( MeshConfig::entityStorage( meshDimension ), "mesh cells must be stored"); }; } // namespace Meshes diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h b/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h index 37e0988199855dce3208b97fb6cbb1f22ec027fe..162ff643063852e9315236fc2ab3ecbe545cd091 100644 --- a/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h +++ b/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/StaticFor.h> @@ -24,11 +30,11 @@ class MeshInitializer; template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag, - bool SubentityStorage = MeshSubentityTraits< MeshConfig, EntityTopology, DimensionsTag::value >::storageEnabled, - bool SubentityOrientationStorage = MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::orientationEnabled, + typename DimensionTag, + bool SubentityStorage = MeshSubentityTraits< MeshConfig, EntityTopology, DimensionTag::value >::storageEnabled, + bool SubentityOrientationStorage = MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag::value >::orientationEnabled, bool SuperentityStorage = MeshSuperentityTraits< MeshConfig, - typename MeshSubentityTraits< MeshConfig, EntityTopology, DimensionsTag::value >::SubentityTopology, + typename MeshSubentityTraits< MeshConfig, EntityTopology, DimensionTag::value >::SubentityTopology, EntityTopology::dimensions >::storageEnabled > class MeshEntityInitializerLayer; @@ -37,30 +43,30 @@ template< typename MeshConfig, class MeshEntityInitializer : public MeshEntityInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< EntityTopology::dimensions - 1 > > + MeshDimensionTag< EntityTopology::dimensions - 1 > > { - typedef MeshDimensionsTag< EntityTopology::dimensions > DimensionsTag; + typedef MeshDimensionTag< EntityTopology::dimensions > DimensionTag; private: typedef MeshEntityInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< EntityTopology::dimensions - 1 > > BaseType; + MeshDimensionTag< EntityTopology::dimensions - 1 > > BaseType; typedef MeshEntityInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< EntityTopology::dimensions - 1 > > SubentityBaseType; + MeshDimensionTag< EntityTopology::dimensions - 1 > > SubentityBaseType; typedef MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, typename - MeshTraits< MeshConfig >::DimensionsTag > SuperentityBaseType; + MeshTraits< MeshConfig >::DimensionTag > SuperentityBaseType; - static const int Dimensions = DimensionsTag::value; + static const int Dimension = DimensionTag::value; typedef MeshTraits< MeshConfig > MeshTraitsType; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; typedef typename MeshTraitsType::LocalIndexType LocalIndexType; - typedef typename MeshTraitsType::template EntityTraits< Dimensions > EntityTraitsType; + typedef typename MeshTraitsType::template EntityTraits< Dimension > EntityTraitsType; typedef typename EntityTraitsType::EntityType EntityType; typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 > SubvertexTraits; @@ -130,34 +136,34 @@ class MeshEntityInitializer< MeshConfig, MeshVertexTopology > */ template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true, false, true > : public MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; - static const int Dimensions = DimensionsTag::value; + static const int Dimension = DimensionTag::value; typedef MeshTraits< MeshConfig > MeshTraitsType; - typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimensions > SubentityTraitsType; + typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimension > SubentityTraitsType; typedef typename SubentityTraitsType::SubentityContainerType SubentityContainerType; typedef typename SubentityTraitsType::AccessArrayType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< EntityTopology::dimensions > EntityDimensionsTag; + typedef MeshDimensionTag< EntityTopology::dimensions > EntityDimensionTag; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionsTag > SubentitySeedsCreatorType; + typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag > SubentitySeedsCreatorType; typedef typename SubentityTraitsType::IdArrayType IdArrayType; typedef typename MeshTraitsType::LocalIndexType LocalIndexType; @@ -165,17 +171,17 @@ class MeshEntityInitializerLayer< MeshConfig, static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& meshInitializer ) { - //cout << " Initiating subentities with " << DimensionsTag::value << " dimensions ... " << std::endl; + //cout << " Initiating subentities with " << DimensionTag::value << " dimensions ... " << std::endl; auto subentitySeeds = SubentitySeedsCreatorType::create( entitySeed ); - IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity ); + IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionTag >( entity ); for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++ ) { //cout << " Adding subentity " << subentityIdsArray[ i ] << std::endl; subentityIdsArray[ i ] = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] ); meshInitializer. - template getSuperentityInitializer< DimensionsTag >(). - addSuperentity( EntityDimensionsTag(), subentityIdsArray[ i ], entityIndex ); + template getSuperentityInitializer< DimensionTag >(). + addSuperentity( EntityDimensionTag(), subentityIdsArray[ i ], entityIndex ); } BaseType::initSubentities( entity, entityIndex, entitySeed, meshInitializer ); } @@ -189,33 +195,33 @@ class MeshEntityInitializerLayer< MeshConfig, */ template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true, true, true > : public MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; - typedef MeshSubentityTraits< MeshConfig, EntityTopology, DimensionsTag::value > SubentitiesTraits; + typedef MeshSubentityTraits< MeshConfig, EntityTopology, DimensionTag::value > SubentitiesTraits; typedef typename SubentitiesTraits::SubentityContainerType SubentityContainerType; typedef typename SubentitiesTraits::AccessArrayType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< EntityTopology::dimensions > EntityDimensionsTag; + typedef MeshDimensionTag< EntityTopology::dimensions > EntityDimensionTag; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionsTag > SubentitySeedsCreatorType; - typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::IdArrayType IdArrayType; + typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag > SubentitySeedsCreatorType; + typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag::value >::IdArrayType IdArrayType; typedef typename MeshTraits< MeshConfig >::LocalIndexType LocalIndexType; typedef typename SubentitiesTraits::OrientationArrayType OrientationArrayType; @@ -223,21 +229,21 @@ class MeshEntityInitializerLayer< MeshConfig, static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& meshInitializer ) { - //cout << " Initiating subentities with " << DimensionsTag::value << " dimensions ... " << std::endl; + //cout << " Initiating subentities with " << DimensionTag::value << " dimensions ... " << std::endl; auto subentitySeeds = SubentitySeedsCreatorType::create( entitySeed ); - IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity ); - OrientationArrayType &subentityOrientationsArray = InitializerType::template subentityOrientationsArray< DimensionsTag >( entity ); + IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionTag >( entity ); + OrientationArrayType &subentityOrientationsArray = InitializerType::template subentityOrientationsArray< DimensionTag >( entity ); for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++ ) { //cout << " Adding subentity " << subentityIdsArray[ i ] << std::endl; GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] ); subentityIdsArray[ i ] = subentityIndex; - subentityOrientationsArray[ i ] = meshInitializer.template getReferenceOrientation< DimensionsTag >( subentityIndex ).createOrientation( subentitySeeds[ i ] ); + subentityOrientationsArray[ i ] = meshInitializer.template getReferenceOrientation< DimensionTag >( subentityIndex ).createOrientation( subentitySeeds[ i ] ); //cout << " Subentity orientation = " << subentityOrientationsArray[ i ].getSubvertexPermutation() << std::endl; meshInitializer. - template getSuperentityInitializer< DimensionsTag >(). - addSuperentity( EntityDimensionsTag(), subentityIdsArray[ i ], entityIndex ); + template getSuperentityInitializer< DimensionTag >(). + addSuperentity( EntityDimensionTag(), subentityIdsArray[ i ], entityIndex ); } BaseType::initSubentities( entity, entityIndex, entitySeed, meshInitializer ); @@ -252,33 +258,33 @@ class MeshEntityInitializerLayer< MeshConfig, */ template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true, true, false > : public MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; - typedef MeshSubentityTraits< MeshConfig, EntityTopology, DimensionsTag::value > SubentitiesTraits; + typedef MeshSubentityTraits< MeshConfig, EntityTopology, DimensionTag::value > SubentitiesTraits; typedef typename SubentitiesTraits::SubentityContainerType SubentityContainerType; typedef typename SubentitiesTraits::SharedContainerType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< EntityTopology::dimensions > EntityDimensionsTag; + typedef MeshDimensionTag< EntityTopology::dimensions > EntityDimensionTag; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionsTag > SubentitySeedsCreatorType; - typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag >::IdArrayType IdArrayType; + typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag > SubentitySeedsCreatorType; + typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag >::IdArrayType IdArrayType; typedef typename MeshTraits< MeshConfig >::LocalIndexType LocalIndexType; typedef typename SubentitiesTraits::OrientationArrayType OrientationArrayType; @@ -286,16 +292,16 @@ class MeshEntityInitializerLayer< MeshConfig, static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& meshInitializer ) { - //cout << " Initiating subentities with " << DimensionsTag::value << " dimensions ... " << std::endl; + //cout << " Initiating subentities with " << DimensionTag::value << " dimensions ... " << std::endl; auto subentitySeeds = SubentitySeedsCreatorType::create( entitySeed ); - IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity ); - OrientationArrayType &subentityOrientationsArray = InitializerType::template subentityOrientationsArray< DimensionsTag >( entity ); + IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionTag >( entity ); + OrientationArrayType &subentityOrientationsArray = InitializerType::template subentityOrientationsArray< DimensionTag >( entity ); for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++ ) { //cout << " Adding subentity " << subentityIdsArray[ i ] << std::endl; subentityIdsArray[ i ] = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] ); - subentityOrientationsArray[ i ] = meshInitializer.template getReferenceOrientation< DimensionsTag >( subentitySeeds[ i ] ).createOrientation( subentitySeeds[ i ] ); + subentityOrientationsArray[ i ] = meshInitializer.template getReferenceOrientation< DimensionTag >( subentitySeeds[ i ] ).createOrientation( subentitySeeds[ i ] ); } BaseType::initSubentities( entity, entityIndex, entitySeed, meshInitializer ); } @@ -304,45 +310,45 @@ class MeshEntityInitializerLayer< MeshConfig, template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true, false, false > : public MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; typedef typename MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value >::SubentityContainerType SubentityContainerType; + DimensionTag::value >::SubentityContainerType SubentityContainerType; typedef typename MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value >::SharedContainerType SharedContainerType; + DimensionTag::value >::SharedContainerType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionsTag > SubentitySeedsCreatorType; - typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag >::IdArrayType IdArrayType; + typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag > SubentitySeedsCreatorType; + typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag >::IdArrayType IdArrayType; typedef typename MeshTraits< MeshConfig >::LocalIndexType LocalIndexType; protected: static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& meshInitializer ) { - //cout << " Initiating subentities with " << DimensionsTag::value << " dimensions ... " << std::endl; + //cout << " Initiating subentities with " << DimensionTag::value << " dimensions ... " << std::endl; auto subentitySeeds = SubentitySeedsCreatorType::create( entitySeed ); - IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity ); + IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionTag >( entity ); for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++) subentityIdsArray[ i ] = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] ); @@ -352,36 +358,36 @@ class MeshEntityInitializerLayer< MeshConfig, template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, false, false, true > : public MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; typedef typename MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value >::SubentityContainerType SubentityContainerType; + DimensionTag::value >::SubentityContainerType SubentityContainerType; typedef typename MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value >::SharedContainerType SharedContainerType; + DimensionTag::value >::SharedContainerType SharedContainerType; typedef typename SharedContainerType::DataType GlobalIndexType; typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< EntityTopology::dimensions > EntityDimensionsTag; + typedef MeshDimensionTag< EntityTopology::dimensions > EntityDimensionTag; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionsTag > SubentitySeedsCreatorType; - typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag >::IdArrayType IdArrayType; + typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag > SubentitySeedsCreatorType; + typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag >::IdArrayType IdArrayType; typedef typename MeshTraits< MeshConfig >::LocalIndexType LocalIndexType; @@ -390,15 +396,15 @@ class MeshEntityInitializerLayer< MeshConfig, static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& meshInitializer ) { - //cout << " Initiating subentities with " << DimensionsTag::value << " dimensions ... " << std::endl; + //cout << " Initiating subentities with " << DimensionTag::value << " dimensions ... " << std::endl; auto subentitySeeds = SubentitySeedsCreatorType::create( entitySeed ); - IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >( entity ); + IdArrayType& subentityIdsArray = InitializerType::template subentityIdsArray< DimensionTag >( entity ); for( LocalIndexType i = 0; i < subentitySeeds.getSize(); i++) { GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( subentitySeeds[ i ] ); meshInitializer. - template getSuperentityInitializer< DimensionsTag >(). - addSuperentity( EntityDimensionsTag(), subentityIndex, entityIndex ); + template getSuperentityInitializer< DimensionTag >(). + addSuperentity( EntityDimensionTag(), subentityIndex, entityIndex ); } BaseType::initSubentities( entity, entityIndex, entitySeed, meshInitializer ); } @@ -406,42 +412,42 @@ class MeshEntityInitializerLayer< MeshConfig, template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, false, false, false > : public MeshEntityInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > {}; template< typename MeshConfig, typename EntityTopology > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, true, false, true > { - typedef MeshDimensionsTag< 0 > DimensionsTag; + typedef MeshDimensionTag< 0 > DimensionTag; typedef MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value > SubentitiesTraits; + DimensionTag::value > SubentitiesTraits; typedef typename SubentitiesTraits::AccessArrayType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< EntityTopology::dimensions > EntityDimensionsTag; + typedef MeshDimensionTag< EntityTopology::dimensions > EntityDimensionTag; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionsTag > SubentitySeedsCreatorType; - typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::IdArrayType IdArrayType; + typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag > SubentitySeedsCreatorType; + typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag::value >::IdArrayType IdArrayType; typedef typename MeshTraits< MeshConfig >::LocalIndexType LocalIndexType; @@ -450,10 +456,10 @@ class MeshEntityInitializerLayer< MeshConfig, static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& meshInitializer ) { - //cout << " Initiating subentities with " << DimensionsTag::value << " dimensions ... " << std::endl; - const IdArrayType &subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >(entity); + //cout << " Initiating subentities with " << DimensionTag::value << " dimensions ... " << std::endl; + const IdArrayType &subentityIdsArray = InitializerType::template subentityIdsArray< DimensionTag >(entity); for( LocalIndexType i = 0; i < subentityIdsArray.getSize(); i++ ) - meshInitializer.template getSuperentityInitializer< DimensionsTag >().addSuperentity( EntityDimensionsTag(), subentityIdsArray[ i ], entityIndex); + meshInitializer.template getSuperentityInitializer< DimensionTag >().addSuperentity( EntityDimensionTag(), subentityIdsArray[ i ], entityIndex); } }; @@ -462,7 +468,7 @@ template< typename MeshConfig, typename EntityTopology > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, true, false, false > @@ -470,16 +476,16 @@ class MeshEntityInitializerLayer< MeshConfig, typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< 0 > DimensionsTag; + typedef MeshDimensionTag< 0 > DimensionTag; typedef MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value > SubentitiesTraits; + DimensionTag::value > SubentitiesTraits; typedef typename SubentitiesTraits::SharedContainerType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionsTag > SubentitySeedsCreatorType; - typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag >::IdArrayType IdArrayType; + typedef MeshSubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag > SubentitySeedsCreatorType; + typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag >::IdArrayType IdArrayType; typedef typename MeshTraits< MeshConfig >::LocalIndexType LocalIndexType; @@ -495,17 +501,17 @@ template< typename MeshConfig, bool SuperEntityStorage > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, false, true, SuperEntityStorage > // Forces termination of recursive inheritance (prevents compiler from generating huge error logs) { typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< 0 > DimensionsTag; + typedef MeshDimensionTag< 0 > DimensionTag; typedef MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value > SubentitiesTraits; + DimensionTag::value > SubentitiesTraits; typedef typename SubentitiesTraits::SharedContainerType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; @@ -519,17 +525,17 @@ template< typename MeshConfig, bool SuperEntityStorage > class MeshEntityInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, false, false, SuperEntityStorage > // Forces termination of recursive inheritance (prevents compiler from generating huge error logs) { typedef MeshInitializer< MeshConfig > InitializerType; typedef MeshEntityInitializer< MeshConfig, EntityTopology > EntityInitializerType; - typedef MeshDimensionsTag< 0 > DimensionsTag; + typedef MeshDimensionTag< 0 > DimensionTag; typedef MeshSubentityTraits< MeshConfig, EntityTopology, - DimensionsTag::value > SubentitiesTraits; + DimensionTag::value > SubentitiesTraits; typedef typename SubentitiesTraits::SharedContainerType SharedContainerType; typedef typename SharedContainerType::ElementType GlobalIndexType; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeed.h b/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeed.h index 4fecf51bd4c4f5fd77ebcf3f1c3dca58202febda..a0f7e561bfead6e1602d3ca754ece09475b29faf 100644 --- a/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeed.h +++ b/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeed.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeedKey.h b/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeedKey.h index f3326bf319fdce2adddd0fec9541b3ac7e5fa332..32ecff1df3b89d6db6c6f96b22aefa3e67f046c2 100644 --- a/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeedKey.h +++ b/src/TNL/Meshes/MeshDetails/initializer/MeshEntitySeedKey.h @@ -8,9 +8,15 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> namespace TNL { namespace Meshes { @@ -21,7 +27,7 @@ class MeshEntitySeed; template< typename MeshConfig, typename EntityTopology, - int Dimensions > + int Dimension > class MeshSubentityTraits; /**** diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h b/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h index 703843c27e7c00bba3912c807e5d18dc71e011fd..e690d35918246db0e51c7206d9a2d90ae2739a6c 100644 --- a/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h +++ b/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h @@ -8,9 +8,15 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> #include <TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h> #include <TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h> #include <TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h> @@ -28,11 +34,11 @@ template< typename MeshConfig > class Mesh; template< typename MeshConfig, - typename DimensionsTag, + typename DimensionTag, bool EntityStorage = - MeshEntityTraits< MeshConfig, DimensionsTag::value >::storageEnabled, + MeshEntityTraits< MeshConfig, DimensionTag::value >::storageEnabled, bool EntityReferenceOrientationStorage = - MeshTraits< MeshConfig >::template EntityTraits< DimensionsTag::value >::orientationNeeded > + MeshTraits< MeshConfig >::template EntityTraits< DimensionTag::value >::orientationNeeded > class MeshInitializerLayer; @@ -43,22 +49,22 @@ class MeshEntityInitializer; template< typename MeshConfig > class MeshInitializer : public MeshInitializerLayer< MeshConfig, - typename MeshTraits< MeshConfig >::DimensionsTag > + typename MeshTraits< MeshConfig >::DimensionTag > { public: typedef Mesh< MeshConfig > MeshType; typedef MeshTraits< MeshConfig > MeshTraitsType; - static const int Dimensions = MeshTraitsType::meshDimensions; - typedef MeshDimensionsTag< Dimensions > DimensionsTag; - typedef MeshInitializerLayer< MeshConfig, DimensionsTag > BaseType; + static const int Dimension = MeshTraitsType::meshDimension; + typedef MeshDimensionTag< Dimension > DimensionTag; + typedef MeshInitializerLayer< MeshConfig, DimensionTag > BaseType; typedef typename MeshTraitsType::PointArrayType PointArrayType; typedef typename MeshTraitsType::CellSeedArrayType CellSeedArrayType; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; - template< typename DimensionsTag, typename SuperdimensionsTag > using SuperentityStorageNetwork = + template< typename DimensionTag, typename SuperdimensionsTag > using SuperentityStorageNetwork = typename MeshTraitsType::template SuperentityTraits< - typename MeshTraitsType::template EntityTraits< DimensionsTag::value >::EntityTopology, + typename MeshTraitsType::template EntityTraits< DimensionTag::value >::EntityTopology, SuperdimensionsTag::value >::StorageNetworkType; @@ -90,39 +96,39 @@ class MeshInitializer return true; } - template<typename SubDimensionsTag, typename EntityType > - static typename MeshTraitsType::template SubentityTraits< typename EntityType::EntityTopology, SubDimensionsTag::value >::IdArrayType& + template<typename SubDimensionTag, typename EntityType > + static typename MeshTraitsType::template SubentityTraits< typename EntityType::EntityTopology, SubDimensionTag::value >::IdArrayType& subentityIdsArray( EntityType& entity ) { - return entity.template subentityIdsArray< SubDimensionsTag::value >(); + return entity.template subentityIdsArray< SubDimensionTag::value >(); } - template< typename SuperDimensionsTag, typename MeshEntity> + template< typename SuperDimensionTag, typename MeshEntity> static typename MeshTraitsType::IdArrayAccessorType& superentityIdsArray( MeshEntity& entity ) { - return entity.template superentityIdsArray< SuperDimensionsTag::value >(); + return entity.template superentityIdsArray< SuperDimensionTag::value >(); } - template<typename SubDimensionsTag, typename MeshEntity > - static typename MeshTraitsType::template SubentityTraits< typename MeshEntity::EntityTopology, SubDimensionsTag::value >::OrientationArrayType& + template<typename SubDimensionTag, typename MeshEntity > + static typename MeshTraitsType::template SubentityTraits< typename MeshEntity::EntityTopology, SubDimensionTag::value >::OrientationArrayType& subentityOrientationsArray( MeshEntity &entity ) { - return entity.template subentityOrientationsArray< SubDimensionsTag::value >(); + return entity.template subentityOrientationsArray< SubDimensionTag::value >(); } - template< typename DimensionsTag > - typename MeshTraitsType::template EntityTraits< DimensionsTag::value >::StorageArrayType& + template< typename DimensionTag > + typename MeshTraitsType::template EntityTraits< DimensionTag::value >::StorageArrayType& meshEntitiesArray() { - return mesh->template entitiesArray< DimensionsTag >(); + return mesh->template entitiesArray< DimensionTag >(); } - template< typename DimensionsTag, typename SuperDimensionsTag > + template< typename DimensionTag, typename SuperDimensionTag > typename MeshTraitsType::GlobalIdArrayType& meshSuperentityIdsArray() { - return mesh->template superentityIdsArray< DimensionsTag, SuperDimensionsTag >(); + return mesh->template superentityIdsArray< DimensionTag, SuperDimensionTag >(); } template< typename EntityTopology, typename SuperdimensionsTag > @@ -138,19 +144,19 @@ class MeshInitializer vertex.setPoint( point ); } - template< typename DimensionsTag > - MeshSuperentityStorageInitializer< MeshConfig, typename MeshTraitsType::template EntityTraits< DimensionsTag::value >::EntityTopology >& + template< typename DimensionTag > + MeshSuperentityStorageInitializer< MeshConfig, typename MeshTraitsType::template EntityTraits< DimensionTag::value >::EntityTopology >& getSuperentityInitializer() { - return BaseType::getSuperentityInitializer( DimensionsTag() ); + return BaseType::getSuperentityInitializer( DimensionTag() ); } - template< typename DimensionsTag > - const MeshEntityReferenceOrientation< MeshConfig, typename MeshTraitsType::template EntityTraits< DimensionsTag::value >::EntityTopology >& + template< typename DimensionTag > + const MeshEntityReferenceOrientation< MeshConfig, typename MeshTraitsType::template EntityTraits< DimensionTag::value >::EntityTopology >& getReferenceOrientation( GlobalIndexType index) const { - return BaseType::getReferenceOrientation( DimensionsTag(), index); + return BaseType::getReferenceOrientation( DimensionTag(), index); } protected: @@ -167,19 +173,19 @@ class MeshInitializer */ template< typename MeshConfig > class MeshInitializerLayer< MeshConfig, - typename MeshTraits< MeshConfig >::DimensionsTag, + typename MeshTraits< MeshConfig >::DimensionTag, true, false > : public MeshInitializerLayer< MeshConfig, - typename MeshTraits< MeshConfig >::DimensionsTag::Decrement > + typename MeshTraits< MeshConfig >::DimensionTag::Decrement > { typedef MeshTraits< MeshConfig > MeshTraitsType; - static const int Dimensions = MeshTraitsType::meshDimensions; - typedef MeshDimensionsTag< Dimensions > DimensionsTag; - typedef MeshInitializerLayer< MeshConfig, typename DimensionsTag::Decrement > BaseType; + static const int Dimension = MeshTraitsType::meshDimension; + typedef MeshDimensionTag< Dimension > DimensionTag; + typedef MeshInitializerLayer< MeshConfig, typename DimensionTag::Decrement > BaseType; typedef Mesh< MeshConfig > MeshType; - typedef typename MeshTraitsType::template EntityTraits< Dimensions > EntityTraitsType; + typedef typename MeshTraitsType::template EntityTraits< Dimension > EntityTraitsType; typedef typename EntityTraitsType::EntityTopology EntityTopology; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; typedef typename MeshTraitsType::CellTopology CellTopology; @@ -204,8 +210,8 @@ class MeshInitializerLayer< MeshConfig, void initEntities( InitializerType &initializer, const PointArrayType &points, const CellSeedArrayType &cellSeeds) { - StorageArrayType &entityArray = initializer.template meshEntitiesArray< DimensionsTag >(); - //cout << " Initiating entities with " << DimensionsTag::value << " dimensions ... " << std::endl; + StorageArrayType &entityArray = initializer.template meshEntitiesArray< DimensionTag >(); + //cout << " Initiating entities with " << DimensionTag::value << " dimensions ... " << std::endl; entityArray.setSize( cellSeeds.getSize() ); for( GlobalIndexType i = 0; i < entityArray.getSize(); i++ ) { @@ -226,7 +232,7 @@ class MeshInitializerLayer< MeshConfig, } using BaseType::getSuperentityInitializer; - SuperentityInitializerType& getSuperentityInitializer( DimensionsTag ) + SuperentityInitializerType& getSuperentityInitializer( DimensionTag ) { return this->superentityInitializer; } @@ -260,7 +266,7 @@ class MeshInitializerLayer< MeshConfig, } private: - typedef typename MeshEntityTraits< MeshConfig, DimensionsTag::value >::SeedIndexedSetType SeedIndexedSet; + typedef typename MeshEntityTraits< MeshConfig, DimensionTag::value >::SeedIndexedSetType SeedIndexedSet; SeedIndexedSet seedsIndexedSet; SuperentityInitializerType superentityInitializer; @@ -272,20 +278,20 @@ class MeshInitializerLayer< MeshConfig, * - entities orientation storage is turned off */ template< typename MeshConfig, - typename DimensionsTag > + typename DimensionTag > class MeshInitializerLayer< MeshConfig, - DimensionsTag, + DimensionTag, true, false > : public MeshInitializerLayer< MeshConfig, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshTraits< MeshConfig > MeshTraitsType; - static const int Dimensions = DimensionsTag::value; - typedef MeshInitializerLayer< MeshConfig, typename DimensionsTag::Decrement > BaseType; + static const int Dimension = DimensionTag::value; + typedef MeshInitializerLayer< MeshConfig, typename DimensionTag::Decrement > BaseType; typedef Mesh< MeshConfig > MeshType; - typedef typename MeshTraitsType::template EntityTraits< Dimensions > EntityTraitsType; + typedef typename MeshTraitsType::template EntityTraits< Dimension > EntityTraitsType; typedef typename EntityTraitsType::EntityTopology EntityTopology; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; typedef typename MeshTraitsType::CellTopology CellTopology; @@ -305,20 +311,20 @@ class MeshInitializerLayer< MeshConfig, typedef typename MeshSubentityTraits< MeshConfig, typename MeshConfig::CellTopology, - DimensionsTag::value >::SubentityContainerType SubentitiesContainerType; + DimensionTag::value >::SubentityContainerType SubentitiesContainerType; public: using BaseType::getEntityInitializer; - EntityInitializerType& getEntityInitializer( DimensionsTag, GlobalIndexType index ) + EntityInitializerType& getEntityInitializer( DimensionTag, GlobalIndexType index ) { //return entityInitializerContainer[ index ]; } void createEntitySeedsFromCellSeeds( const CellSeedArrayType& cellSeeds ) { - typedef MeshSubentitySeedsCreator< MeshConfig, CellTopology, DimensionsTag > SubentitySeedsCreator; - //cout << " Creating mesh entities with " << DimensionsTag::value << " dimensions ... " << std::endl; + typedef MeshSubentitySeedsCreator< MeshConfig, CellTopology, DimensionTag > SubentitySeedsCreator; + //cout << " Creating mesh entities with " << DimensionTag::value << " dimensions ... " << std::endl; for( GlobalIndexType i = 0; i < cellSeeds.getSize(); i++ ) { //cout << " Creating mesh entities from cell number " << i << " : " << cellSeeds[ i ] << std::endl; @@ -344,15 +350,15 @@ class MeshInitializerLayer< MeshConfig, } using BaseType::getSuperentityInitializer; - SuperentityInitializerType& getSuperentityInitializer( DimensionsTag ) + SuperentityInitializerType& getSuperentityInitializer( DimensionTag ) { return this->superentityInitializer; } void initEntities( InitializerType& initializer, const PointArrayType& points ) { - StorageArrayType &entityArray = initializer.template meshEntitiesArray< DimensionsTag >(); - //cout << " Initiating entities with " << DimensionsTag::value << " dimensions ... " << std::endl; + StorageArrayType &entityArray = initializer.template meshEntitiesArray< DimensionTag >(); + //cout << " Initiating entities with " << DimensionTag::value << " dimensions ... " << std::endl; entityArray.setSize( this->seedsIndexedSet.getSize() ); EntitySeedArrayType seedsArray; seedsArray.setSize( this->seedsIndexedSet.getSize() ); @@ -372,7 +378,7 @@ class MeshInitializerLayer< MeshConfig, void createEntityReferenceOrientations() const {} private: - typedef typename MeshEntityTraits< MeshConfig, DimensionsTag::value >::SeedIndexedSetType SeedIndexedSet; + typedef typename MeshEntityTraits< MeshConfig, DimensionTag::value >::SeedIndexedSetType SeedIndexedSet; SeedIndexedSet seedsIndexedSet; SuperentityInitializerType superentityInitializer; }; @@ -383,20 +389,20 @@ class MeshInitializerLayer< MeshConfig, * - entities orientation storage is turned on */ template< typename MeshConfig, - typename DimensionsTag > + typename DimensionTag > class MeshInitializerLayer< MeshConfig, - DimensionsTag, + DimensionTag, true, true > : public MeshInitializerLayer< MeshConfig, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshInitializerLayer< MeshConfig, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; typedef Mesh< MeshConfig > MeshType; typedef typename MeshType::MeshTraitsType MeshTraitsType; - typedef typename MeshType::template EntityTraits< DimensionsTag::value > EntityTraitsType; + typedef typename MeshType::template EntityTraits< DimensionTag::value > EntityTraitsType; typedef typename EntityTraitsType::EntityTopology EntityTopology; typedef typename EntityTraitsType::EntityType EntityType; typedef typename EntityTraitsType::StorageArrayType ContainerType; @@ -422,20 +428,20 @@ class MeshInitializerLayer< MeshConfig, typedef typename MeshSubentityTraits< MeshConfig, typename MeshConfig::CellTopology, - DimensionsTag::value >::SubentityContainerType SubentitiesContainerType; + DimensionTag::value >::SubentityContainerType SubentitiesContainerType; public: using BaseType::getEntityInitializer; - EntityInitializerType& getEntityInitializer( DimensionsTag, GlobalIndexType index ) + EntityInitializerType& getEntityInitializer( DimensionTag, GlobalIndexType index ) { //return entityInitializerContainer[ index ]; } void createEntitySeedsFromCellSeeds( const CellSeedArrayType& cellSeeds ) { - typedef MeshSubentitySeedsCreator< MeshConfig, CellTopology, DimensionsTag > SubentitySeedsCreator; - //cout << " Creating mesh entities with " << DimensionsTag::value << " dimensions ... " << std::endl; + typedef MeshSubentitySeedsCreator< MeshConfig, CellTopology, DimensionTag > SubentitySeedsCreator; + //cout << " Creating mesh entities with " << DimensionTag::value << " dimensions ... " << std::endl; for( GlobalIndexType i = 0; i < cellSeeds.getSize(); i++ ) { //cout << " Creating mesh entities from cell number " << i << " : " << cellSeeds[ i ] << std::endl; @@ -460,15 +466,15 @@ class MeshInitializerLayer< MeshConfig, } using BaseType::getSuperentityInitializer; - SuperentityInitializerType& getSuperentityInitializer( DimensionsTag ) + SuperentityInitializerType& getSuperentityInitializer( DimensionTag ) { return this->superentityInitializer; } void initEntities( InitializerType& initializer, const PointArrayType& points ) { - EntityArrayType &entityArray = initializer.template meshEntitiesArray< DimensionsTag >(); - //cout << " Initiating entities with " << DimensionsTag::value << " dimensions ... " << std::endl; + EntityArrayType &entityArray = initializer.template meshEntitiesArray< DimensionTag >(); + //cout << " Initiating entities with " << DimensionTag::value << " dimensions ... " << std::endl; entityArray.setSize( this->seedsIndexedSet.getSize() ); SeedArrayType seedsArray; seedsArray.setSize( this->seedsIndexedSet.getSize() ); @@ -486,14 +492,14 @@ class MeshInitializerLayer< MeshConfig, } using BaseType::getReferenceOrientation; - const ReferenceOrientationType& getReferenceOrientation( DimensionsTag, GlobalIndexType index) const + const ReferenceOrientationType& getReferenceOrientation( DimensionTag, GlobalIndexType index) const { return this->referenceOrientations[ index ]; } void createEntityReferenceOrientations() { - //cout << " Creating entity reference orientations with " << DimensionsTag::value << " dimensions ... " << std::endl; + //cout << " Creating entity reference orientations with " << DimensionTag::value << " dimensions ... " << std::endl; SeedArrayType seedsArray; seedsArray.setSize( this->seedsIndexedSet.getSize() ); this->seedsIndexedSet.toArray( seedsArray ); @@ -508,7 +514,7 @@ class MeshInitializerLayer< MeshConfig, private: - typedef typename MeshEntityTraits< MeshConfig, DimensionsTag::value >::SeedIndexedSetType SeedIndexedSet; + typedef typename MeshEntityTraits< MeshConfig, DimensionTag::value >::SeedIndexedSetType SeedIndexedSet; SeedIndexedSet seedsIndexedSet; SuperentityInitializerType superentityInitializer; ReferenceOrientationArrayType referenceOrientations; @@ -518,13 +524,13 @@ class MeshInitializerLayer< MeshConfig, * Mesh initializer layer for entities not being stored */ template< typename MeshConfig, - typename DimensionsTag > + typename DimensionTag > class MeshInitializerLayer< MeshConfig, - DimensionsTag, + DimensionTag, false, false > : public MeshInitializerLayer< MeshConfig, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > {}; /**** @@ -534,15 +540,15 @@ class MeshInitializerLayer< MeshConfig, */ template< typename MeshConfig > class MeshInitializerLayer< MeshConfig, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, true, false > { typedef Mesh< MeshConfig > MeshType; typedef typename MeshType::MeshTraitsType MeshTraitsType; - typedef MeshDimensionsTag< 0 > DimensionsTag; + typedef MeshDimensionTag< 0 > DimensionTag; - typedef typename MeshType::template EntityTraits< DimensionsTag::value > EntityTraitsType; + typedef typename MeshType::template EntityTraits< DimensionTag::value > EntityTraitsType; typedef typename EntityTraitsType::EntityTopology EntityTopology; typedef typename EntityTraitsType::StorageArrayType ContainerType; typedef typename EntityTraitsType::AccessArrayType SharedContainerType; @@ -574,7 +580,7 @@ class MeshInitializerLayer< MeshConfig, return *( this->mesh ); } - VertexInitializerType& getEntityInitializer( DimensionsTag, GlobalIndexType index ) + VertexInitializerType& getEntityInitializer( DimensionTag, GlobalIndexType index ) { TNL_ASSERT( index >= 0 && index < vertexInitializerContainer.getSize(), std::cerr << " index = " << index @@ -586,7 +592,7 @@ class MeshInitializerLayer< MeshConfig, void initEntities( InitializerType& initializer, const PointArrayType& points ) { - EntityArrayType &vertexArray = initializer.template meshEntitiesArray< DimensionsTag >(); + EntityArrayType &vertexArray = initializer.template meshEntitiesArray< DimensionTag >(); vertexArray.setSize( points.getSize() ); for( GlobalIndexType i = 0; i < vertexArray.getSize(); i++ ) EntityInitializerType::setVertexPoint( vertexArray[i], points[i], initializer ); @@ -598,10 +604,10 @@ class MeshInitializerLayer< MeshConfig, void createEntityInitializers() { - vertexInitializerContainer.setSize( this->getMesh().template getNumberOfEntities< DimensionsTag::value >() ); + vertexInitializerContainer.setSize( this->getMesh().template getNumberOfEntities< DimensionTag::value >() ); } - SuperentityInitializerType& getSuperentityInitializer( DimensionsTag ) + SuperentityInitializerType& getSuperentityInitializer( DimensionTag ) { return this->superentityInitializer; } diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshSubentitySeedCreator.h b/src/TNL/Meshes/MeshDetails/initializer/MeshSubentitySeedCreator.h index 3e5233e8344b205442b78c27328a4dba1a0044ed..f7069f4cf5d5e674f61b37d8f604a10dd0c17140 100644 --- a/src/TNL/Meshes/MeshDetails/initializer/MeshSubentitySeedCreator.h +++ b/src/TNL/Meshes/MeshDetails/initializer/MeshSubentitySeedCreator.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/StaticFor.h> @@ -17,11 +23,11 @@ namespace Meshes { template< typename MeshConfig, typename EntityTopology, - typename SubDimensionsTag > + typename SubDimensionTag > class MeshSubentitySeedsCreator { typedef typename MeshTraits< MeshConfig >::LocalIndexType LocalIndexType; - typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, SubDimensionsTag::value > SubentityTraits; + typedef typename MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, SubDimensionTag::value > SubentityTraits; typedef typename SubentityTraits::SubentityTopology SubentityTopology; typedef typename MeshTraits< MeshConfig >::IdArrayAccessorType IdArrayAccessorType; typedef typename MeshTraits< MeshConfig >::template SubentityTraits< SubentityTopology, 0 > SubentityVertexTraits; @@ -32,7 +38,7 @@ class MeshSubentitySeedsCreator public: typedef typename SubentityTraits::SeedArrayType SubentitySeedArray; typedef MeshEntitySeed< MeshConfig, EntityTopology > EntitySeed; - //typedef typename MeshEntityTraits< MeshConfig, SubDimensionsTag >::SeedIndexedSetType SeedIndexedSet; + //typedef typename MeshEntityTraits< MeshConfig, SubDimensionTag >::SeedIndexedSetType SeedIndexedSet; //template< typename SeedIndexedSet > static SubentitySeedArray create( const EntitySeed &entitySeed ) diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshSuperentityStorageInitializer.h b/src/TNL/Meshes/MeshDetails/initializer/MeshSuperentityStorageInitializer.h index af39848bfaa7c7dde09e2df5fe29d81bf4b43781..587cb03a30c89f22a82a05045ef2dad456b3ab02 100644 --- a/src/TNL/Meshes/MeshDetails/initializer/MeshSuperentityStorageInitializer.h +++ b/src/TNL/Meshes/MeshDetails/initializer/MeshSuperentityStorageInitializer.h @@ -8,9 +8,15 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> #include <algorithm> #include <vector> @@ -22,48 +28,48 @@ class MeshInitializer; template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag, - bool SuperentityStorage = MeshSuperentityTraits< MeshConfig, EntityTopology, DimensionsTag::value >::storageEnabled > + typename DimensionTag, + bool SuperentityStorage = MeshSuperentityTraits< MeshConfig, EntityTopology, DimensionTag::value >::storageEnabled > class MeshSuperentityStorageInitializerLayer; template< typename MeshConfig, typename EntityTopology > class MeshSuperentityStorageInitializer : - public MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, MeshDimensionsTag< MeshTraits< MeshConfig >::meshDimensions > > + public MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, MeshDimensionTag< MeshTraits< MeshConfig >::meshDimension > > {}; template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true > : public MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; - static const int Dimensions = DimensionsTag::value; - typedef MeshDimensionsTag< EntityTopology::dimensions > EntityDimensions; + static const int Dimension = DimensionTag::value; + typedef MeshDimensionTag< EntityTopology::dimensions > EntityDimension; typedef MeshTraits< MeshConfig > MeshTraitsType; typedef typename MeshTraitsType::GlobalIdArrayType GlobalIdArrayType; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; typedef typename MeshTraitsType::LocalIndexType LocalIndexType; typedef MeshInitializer< MeshConfig > MeshInitializerType; - typedef typename MeshTraitsType::template SuperentityTraits< EntityTopology, Dimensions > SuperentityTraitsType; + typedef typename MeshTraitsType::template SuperentityTraits< EntityTopology, Dimension > SuperentityTraitsType; typedef typename SuperentityTraitsType::StorageNetworkType SuperentityStorageNetwork; public: using BaseType::addSuperentity; - void addSuperentity( DimensionsTag, GlobalIndexType entityIndex, GlobalIndexType superentityIndex) + void addSuperentity( DimensionTag, GlobalIndexType entityIndex, GlobalIndexType superentityIndex) { - //cout << "Adding superentity with " << DimensionsTag::value << " dimensions of enity with " << EntityDimensions::value << " ... " << std::endl; + //cout << "Adding superentity with " << DimensionTag::value << " dimensions of enity with " << EntityDimension::value << " ... " << std::endl; indexPairs.push_back( IndexPair{ entityIndex, superentityIndex } ); } @@ -75,11 +81,11 @@ class MeshSuperentityStorageInitializerLayer< MeshConfig, indexPairs.end(), []( IndexPair pair0, IndexPair pair1 ){ return ( pair0.entityIndex < pair1.entityIndex ); } );*/ - GlobalIdArrayType &superentityIdsArray = meshInitializer.template meshSuperentityIdsArray< EntityDimensions, DimensionsTag >(); + GlobalIdArrayType &superentityIdsArray = meshInitializer.template meshSuperentityIdsArray< EntityDimension, DimensionTag >(); superentityIdsArray.setSize( static_cast< GlobalIndexType >( indexPairs.size() ) ); GlobalIndexType currentBegin = 0; GlobalIndexType lastEntityIndex = 0; - std::cout << "There are " << superentityIdsArray.getSize() << " superentities with " << DimensionsTag::value << " dimensions of enities with " << EntityDimensions::value << " ... " << std::endl; + std::cout << "There are " << superentityIdsArray.getSize() << " superentities with " << DimensionTag::value << " dimensions of enities with " << EntityDimension::value << " ... " << std::endl; for( GlobalIndexType i = 0; i < superentityIdsArray.getSize(); i++) { superentityIdsArray[ i ] = indexPairs[i].superentityIndex; @@ -87,26 +93,26 @@ class MeshSuperentityStorageInitializerLayer< MeshConfig, //cout << "Adding superentity " << indexPairs[i].superentityIndex << " to entity " << lastEntityIndex << std::endl; if( indexPairs[ i ].entityIndex != lastEntityIndex ) { - meshInitializer.template superentityIdsArray< DimensionsTag >( meshInitializer.template meshEntitiesArray< EntityDimensions >()[ lastEntityIndex ] ).bind( superentityIdsArray, currentBegin, i - currentBegin ); + meshInitializer.template superentityIdsArray< DimensionTag >( meshInitializer.template meshEntitiesArray< EntityDimension >()[ lastEntityIndex ] ).bind( superentityIdsArray, currentBegin, i - currentBegin ); currentBegin = i; lastEntityIndex = indexPairs[ i ].entityIndex; } } - meshInitializer.template superentityIdsArray< DimensionsTag >( meshInitializer.template meshEntitiesArray< EntityDimensions >()[ lastEntityIndex ] ).bind( superentityIdsArray, currentBegin, superentityIdsArray.getSize() - currentBegin ); + meshInitializer.template superentityIdsArray< DimensionTag >( meshInitializer.template meshEntitiesArray< EntityDimension >()[ lastEntityIndex ] ).bind( superentityIdsArray, currentBegin, superentityIdsArray.getSize() - currentBegin ); indexPairs.clear(); /**** * Network initializer */ - SuperentityStorageNetwork& superentityStorageNetwork = meshInitializer.template meshSuperentityStorageNetwork< EntityTopology, DimensionsTag >(); + SuperentityStorageNetwork& superentityStorageNetwork = meshInitializer.template meshSuperentityStorageNetwork< EntityTopology, DimensionTag >(); //GlobalIndexType lastEntityIndex( 0 ); superentityStorageNetwork.setRanges( - meshInitializer.template meshEntitiesArray< EntityDimensions >().getSize(), - meshInitializer.template meshEntitiesArray< DimensionsTag >().getSize() ); + meshInitializer.template meshEntitiesArray< EntityDimension >().getSize(), + meshInitializer.template meshEntitiesArray< DimensionTag >().getSize() ); lastEntityIndex = 0; typename SuperentityStorageNetwork::ValuesAllocationVectorType storageNetworkAllocationVector; - storageNetworkAllocationVector.setSize( meshInitializer.template meshEntitiesArray< EntityDimensions >().getSize() ); + storageNetworkAllocationVector.setSize( meshInitializer.template meshEntitiesArray< EntityDimension >().getSize() ); storageNetworkAllocationVector.setValue( 0 ); for( GlobalIndexType i = 0; i < superentityIdsArray.getSize(); i++) { @@ -145,18 +151,18 @@ class MeshSuperentityStorageInitializerLayer< MeshConfig, template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, false > : public MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; typedef MeshInitializer< MeshConfig > MeshInitializerType; public: @@ -169,7 +175,7 @@ template< typename MeshConfig, typename EntityTopology > class MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< EntityTopology::dimensions >, + MeshDimensionTag< EntityTopology::dimensions >, true > { typedef MeshInitializer< MeshConfig > MeshInitializerType; @@ -183,7 +189,7 @@ template< typename MeshConfig, typename EntityTopology > class MeshSuperentityStorageInitializerLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< EntityTopology::dimensions >, + MeshDimensionTag< EntityTopology::dimensions >, false > { typedef MeshInitializer< MeshConfig > MeshInitializerType; diff --git a/src/TNL/Meshes/MeshDetails/layers/MeshStorageLayer.h b/src/TNL/Meshes/MeshDetails/layers/MeshStorageLayer.h index 00b7ed5e912346242a633dc7637d15499c23836f..bd31795a5cb2d774d8a76e87aa6c4c99b96dcab4 100644 --- a/src/TNL/Meshes/MeshDetails/layers/MeshStorageLayer.h +++ b/src/TNL/Meshes/MeshDetails/layers/MeshStorageLayer.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/File.h> @@ -19,35 +25,35 @@ namespace TNL { namespace Meshes { template< typename MeshConfig, - typename DimensionsTag, - bool EntityStorage = MeshEntityTraits< MeshConfig, DimensionsTag::value >::storageEnabled > + typename DimensionTag, + bool EntityStorage = MeshEntityTraits< MeshConfig, DimensionTag::value >::storageEnabled > class MeshStorageLayer; template< typename MeshConfig > class MeshStorageLayers - : public MeshStorageLayer< MeshConfig, typename MeshTraits< MeshConfig >::DimensionsTag > + : public MeshStorageLayer< MeshConfig, typename MeshTraits< MeshConfig >::DimensionTag > { }; template< typename MeshConfig, - typename DimensionsTag > + typename DimensionTag > class MeshStorageLayer< MeshConfig, - DimensionsTag, + DimensionTag, true > - : public MeshStorageLayer< MeshConfig, typename DimensionsTag::Decrement >, + : public MeshStorageLayer< MeshConfig, typename DimensionTag::Decrement >, public MeshSuperentityStorageLayers< MeshConfig, - typename MeshTraits< MeshConfig >::template EntityTraits< DimensionsTag::value >::EntityTopology > + typename MeshTraits< MeshConfig >::template EntityTraits< DimensionTag::value >::EntityTopology > { public: - static const int Dimensions = DimensionsTag::value; - typedef MeshStorageLayer< MeshConfig, typename DimensionsTag::Decrement > BaseType; + static const int Dimension = DimensionTag::value; + typedef MeshStorageLayer< MeshConfig, typename DimensionTag::Decrement > BaseType; typedef MeshSuperentityStorageLayers< MeshConfig, - typename MeshTraits< MeshConfig >::template EntityTraits< DimensionsTag::value >::EntityTopology > SuperentityStorageBaseType; + typename MeshTraits< MeshConfig >::template EntityTraits< DimensionTag::value >::EntityTopology > SuperentityStorageBaseType; typedef MeshTraits< MeshConfig > MeshTraitsType; - typedef typename MeshTraitsType::template EntityTraits< Dimensions > EntityTraitsType; + typedef typename MeshTraitsType::template EntityTraits< Dimension > EntityTraitsType; typedef typename EntityTraitsType::StorageArrayType StorageArrayType; typedef typename EntityTraitsType::AccessArrayType AccessArrayType; @@ -64,29 +70,29 @@ class MeshStorageLayer< MeshConfig, { } - GlobalIndexType getNumberOfEntities( DimensionsTag ) const + GlobalIndexType getNumberOfEntities( DimensionTag ) const { return this->entities.getSize(); } - EntityType& getEntity( DimensionsTag, + EntityType& getEntity( DimensionTag, const GlobalIndexType entityIndex ) { return this->entities[ entityIndex ]; } - const EntityType& getEntity( DimensionsTag, + const EntityType& getEntity( DimensionTag, const GlobalIndexType entityIndex ) const { return this->entities[ entityIndex ]; } - AccessArrayType& getEntities( DimensionsTag ) + AccessArrayType& getEntities( DimensionTag ) { return this->sharedEntities; } - const AccessArrayType& getEntities( DimensionsTag ) const + const AccessArrayType& getEntities( DimensionTag ) const { return this->sharedEntities; } @@ -96,7 +102,7 @@ class MeshStorageLayer< MeshConfig, if( ! BaseType::save( file ) || ! this->entities.save( file ) ) { - std::cerr << "Saving of the mesh entities with " << DimensionsTag::value << " dimensions failed." << std::endl; + std::cerr << "Saving of the mesh entities with " << DimensionTag::value << " dimensions failed." << std::endl; return false; } return true; @@ -104,11 +110,11 @@ class MeshStorageLayer< MeshConfig, bool load( File& file ) { - //cout << "Loading mesh layer with dimensions " << DimensionsTag::value << std::endl; + //cout << "Loading mesh layer with dimensions " << DimensionTag::value << std::endl; if( ! BaseType::load( file ) || ! this->entities.load( file ) ) { - std::cerr << "Loading of the mesh entities with " << DimensionsTag::value << " dimensions failed." << std::endl; + std::cerr << "Loading of the mesh entities with " << DimensionTag::value << " dimensions failed." << std::endl; return false; } this->entitiesAccess.bind( this->entities ); @@ -118,7 +124,7 @@ class MeshStorageLayer< MeshConfig, void print( std::ostream& str ) const { BaseType::print( str ); - str << "The entities with " << DimensionsTag::value << " dimensions are: " << std::endl; + str << "The entities with " << DimensionTag::value << " dimensions are: " << std::endl; for( GlobalIndexType i = 0; i < entities.getSize();i ++ ) { str << i << " "; @@ -144,44 +150,44 @@ class MeshStorageLayer< MeshConfig, using BaseType::entitiesArray; - typename EntityTraitsType::StorageArrayType& entitiesArray( DimensionsTag ) + typename EntityTraitsType::StorageArrayType& entitiesArray( DimensionTag ) { return entities; } using BaseType::superentityIdsArray; - template< typename SuperDimensionsTag > - typename MeshTraitsType::GlobalIdArrayType& superentityIdsArray( DimensionsTag ) + template< typename SuperDimensionTag > + typename MeshTraitsType::GlobalIdArrayType& superentityIdsArray( DimensionTag ) { - return SuperentityStorageBaseType::superentityIdsArray( SuperDimensionsTag() ); + return SuperentityStorageBaseType::superentityIdsArray( SuperDimensionTag() ); } using BaseType::getSuperentityStorageNetwork; template< typename SuperdimensionsTag > typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType& - getSuperentityStorageNetwork( MeshDimensionsTag< EntityTopology::dimensions > ) + getSuperentityStorageNetwork( MeshDimensionTag< EntityTopology::dimensions > ) { return SuperentityStorageBaseType::getStorageNetwork( SuperdimensionsTag() ); } }; template< typename MeshConfig, - typename DimensionsTag > -class MeshStorageLayer< MeshConfig, DimensionsTag, false > - : public MeshStorageLayer< MeshConfig, typename DimensionsTag::Decrement > + typename DimensionTag > +class MeshStorageLayer< MeshConfig, DimensionTag, false > + : public MeshStorageLayer< MeshConfig, typename DimensionTag::Decrement > { }; template< typename MeshConfig > -class MeshStorageLayer< MeshConfig, MeshDimensionsTag< 0 >, true > : +class MeshStorageLayer< MeshConfig, MeshDimensionTag< 0 >, true > : public MeshSuperentityStorageLayers< MeshConfig, MeshVertexTopology > { public: - typedef MeshDimensionsTag< 0 > DimensionsTag; + typedef MeshDimensionTag< 0 > DimensionTag; typedef MeshSuperentityStorageLayers< MeshConfig, MeshVertexTopology > SuperentityStorageBaseType; @@ -233,29 +239,29 @@ class MeshStorageLayer< MeshConfig, MeshDimensionsTag< 0 >, true > : * with higher dimensions entities storage layers. */ - GlobalIndexType getNumberOfEntities( DimensionsTag ) const + GlobalIndexType getNumberOfEntities( DimensionTag ) const { return this->vertices.getSize(); } - VertexType& getEntity( DimensionsTag, + VertexType& getEntity( DimensionTag, const GlobalIndexType entityIndex ) { return this->vertices[ entityIndex ]; } - const VertexType& getEntity( DimensionsTag, + const VertexType& getEntity( DimensionTag, const GlobalIndexType entityIndex ) const { return this->vertices.getElement( entityIndex ); } - AccessArrayType& getEntities( DimensionsTag ) + AccessArrayType& getEntities( DimensionTag ) { return this->sharedVertices; } - const AccessArrayType& getEntities( DimensionsTag ) const + const AccessArrayType& getEntities( DimensionTag ) const { return this->sharedVertices; } @@ -264,7 +270,7 @@ class MeshStorageLayer< MeshConfig, MeshDimensionsTag< 0 >, true > : { if( ! this->vertices.save( file ) ) { - std::cerr << "Saving of the mesh entities with " << DimensionsTag::value << " dimensions failed." << std::endl; + std::cerr << "Saving of the mesh entities with " << DimensionTag::value << " dimensions failed." << std::endl; return false; } return true; @@ -274,7 +280,7 @@ class MeshStorageLayer< MeshConfig, MeshDimensionsTag< 0 >, true > : { if( ! this->vertices.load( file ) ) { - std::cerr << "Loading of the mesh entities with " << DimensionsTag::value << " dimensions failed." << std::endl; + std::cerr << "Loading of the mesh entities with " << DimensionTag::value << " dimensions failed." << std::endl; return false; } this->verticesAccess.bind( this->vertices ); @@ -305,20 +311,20 @@ class MeshStorageLayer< MeshConfig, MeshDimensionsTag< 0 >, true > : // TODO: this is only for the mesh initializer - fix it public: - typename EntityTraitsType::StorageArrayType& entitiesArray( DimensionsTag ) + typename EntityTraitsType::StorageArrayType& entitiesArray( DimensionTag ) { return vertices; } - template< typename SuperDimensionsTag > - typename MeshTraitsType::GlobalIdArrayType& superentityIdsArray( DimensionsTag ) + template< typename SuperDimensionTag > + typename MeshTraitsType::GlobalIdArrayType& superentityIdsArray( DimensionTag ) { - return SuperentityStorageBaseType::superentityIdsArray( SuperDimensionsTag() ); + return SuperentityStorageBaseType::superentityIdsArray( SuperDimensionTag() ); } template< typename SuperdimensionsTag > - typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType& getSuperentityStorageNetwork( MeshDimensionsTag< EntityTopology::dimensions > ) + typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperdimensionsTag::value >::StorageNetworkType& getSuperentityStorageNetwork( MeshDimensionTag< EntityTopology::dimensions > ) { return SuperentityStorageBaseType::getStorageNetwork( SuperdimensionsTag() ); } @@ -329,7 +335,7 @@ class MeshStorageLayer< MeshConfig, MeshDimensionsTag< 0 >, true > : * Forces termination of recursive inheritance (prevents compiler from generating huge error logs) */ template< typename MeshConfig > -class MeshStorageLayer< MeshConfig, MeshDimensionsTag< 0 >, false > +class MeshStorageLayer< MeshConfig, MeshDimensionTag< 0 >, false > { }; diff --git a/src/TNL/Meshes/MeshDetails/layers/MeshSubentityStorageLayer.h b/src/TNL/Meshes/MeshDetails/layers/MeshSubentityStorageLayer.h index 6acf7017df34aab6c4258a25085aaa3973308e86..13d40fd980f9616741eaf14986c6010ab9fb9beb 100644 --- a/src/TNL/Meshes/MeshDetails/layers/MeshSubentityStorageLayer.h +++ b/src/TNL/Meshes/MeshDetails/layers/MeshSubentityStorageLayer.h @@ -8,10 +8,16 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/File.h> -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> #include <TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h> #include <TNL/Meshes/MeshDetails/MeshEntityOrientation.h> @@ -20,11 +26,11 @@ namespace Meshes { template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag, + typename DimensionTag, bool SubentityStorage = - MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::storageEnabled, + MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag::value >::storageEnabled, bool SubentityOrientationStorage = - MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionsTag::value >::orientationEnabled > + MeshTraits< MeshConfig >::template SubentityTraits< EntityTopology, DimensionTag::value >::orientationEnabled > class MeshSubentityStorageLayer; @@ -33,32 +39,32 @@ template< typename MeshConfig, class MeshSubentityStorageLayers : public MeshSubentityStorageLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< EntityTopology::dimensions - 1 > > + MeshDimensionTag< EntityTopology::dimensions - 1 > > { }; template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshSubentityStorageLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true, true > : public MeshSubentityStorageLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshSubentityStorageLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; protected: - static const int Dimensions = DimensionsTag::value; + static const int Dimension = DimensionTag::value; typedef MeshTraits< MeshConfig > MeshTraitsType; - typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimensions > SubentityTraitsType; + typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimension > SubentityTraitsType; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; typedef typename MeshTraitsType::LocalIndexType LocalIndexType; typedef typename SubentityTraitsType::IdArrayType IdArrayType; @@ -72,7 +78,7 @@ class MeshSubentityStorageLayer< MeshConfig, ~MeshSubentityStorageLayer() { - //cout << " Destroying " << this->sharedSubentitiesIndices.getSize() << " subentities with "<< DimensionsTag::value << " dimensions." << std::endl; + //cout << " Destroying " << this->sharedSubentitiesIndices.getSize() << " subentities with "<< DimensionTag::value << " dimensions." << std::endl; } MeshSubentityStorageLayer& operator = ( const MeshSubentityStorageLayer& layer ) @@ -87,7 +93,7 @@ class MeshSubentityStorageLayer< MeshConfig, if( ! BaseType::save( file ) || ! this->subentitiesIndices.save( file ) ) { - std::cerr << "Saving of the entity subentities layer with " << DimensionsTag::value << " failed." << std::endl; + std::cerr << "Saving of the entity subentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -98,7 +104,7 @@ class MeshSubentityStorageLayer< MeshConfig, if( ! BaseType::load( file ) || ! this->subentitiesIndices.load( file ) ) { - std::cerr << "Loading of the entity subentities layer with " << DimensionsTag::value << " failed." << std::endl; + std::cerr << "Loading of the entity subentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -108,7 +114,7 @@ class MeshSubentityStorageLayer< MeshConfig, { BaseType::print( str ); str << std::endl; - str << "\t Subentities with " << DimensionsTag::value << " dimensions are: " << subentitiesIndices << "."; + str << "\t Subentities with " << DimensionTag::value << " dimensions are: " << subentitiesIndices << "."; } bool operator==( const MeshSubentityStorageLayer& layer ) const @@ -126,24 +132,24 @@ class MeshSubentityStorageLayer< MeshConfig, /**** * Define setter/getter for the current level of the subentities */ - void setSubentityIndex( DimensionsTag, + void setSubentityIndex( DimensionTag, const LocalIndexType localIndex, const GlobalIndexType globalIndex ) { this->subentitiesIndices[ localIndex ] = globalIndex; } - GlobalIndexType getSubentityIndex( DimensionsTag, + GlobalIndexType getSubentityIndex( DimensionTag, const LocalIndexType localIndex ) const { return this->subentitiesIndices[ localIndex ]; } using BaseType::subentityIdsArray; - IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; } + IdArrayType& subentityIdsArray( DimensionTag ) { return this->subentitiesIndices; } using BaseType::subentityOrientation; - IdPermutationArrayAccessorType subentityOrientation( DimensionsTag, LocalIndexType index) const + IdPermutationArrayAccessorType subentityOrientation( DimensionTag, LocalIndexType index) const { TNL_ASSERT( 0 <= index && index < SubentityTraitsType::count, ); @@ -151,7 +157,7 @@ class MeshSubentityStorageLayer< MeshConfig, } using BaseType::subentityOrientationsArray; - OrientationArrayType& subentityOrientationsArray( DimensionsTag ) { return this->subentityOrientations; } + OrientationArrayType& subentityOrientationsArray( DimensionTag ) { return this->subentityOrientations; } private: IdArrayType subentitiesIndices; @@ -162,25 +168,25 @@ class MeshSubentityStorageLayer< MeshConfig, template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshSubentityStorageLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true, false > : public MeshSubentityStorageLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { typedef MeshSubentityStorageLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > BaseType; + typename DimensionTag::Decrement > BaseType; protected: - static const int Dimensions = DimensionsTag::value; + static const int Dimension = DimensionTag::value; typedef MeshTraits< MeshConfig > MeshTraitsType; - typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimensions > SubentityTraitsType; + typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimension > SubentityTraitsType; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; typedef typename MeshTraitsType::LocalIndexType LocalIndexType; typedef typename SubentityTraitsType::IdArrayType IdArrayType; @@ -194,7 +200,7 @@ class MeshSubentityStorageLayer< MeshConfig, ~MeshSubentityStorageLayer() { - //cout << " Destroying " << this->sharedSubentitiesIndices.getSize() << " subentities with "<< DimensionsTag::value << " dimensions." << std::endl; + //cout << " Destroying " << this->sharedSubentitiesIndices.getSize() << " subentities with "<< DimensionTag::value << " dimensions." << std::endl; } MeshSubentityStorageLayer& operator = ( const MeshSubentityStorageLayer& layer ) @@ -209,7 +215,7 @@ class MeshSubentityStorageLayer< MeshConfig, if( ! BaseType::save( file ) || ! this->subentitiesIndices.save( file ) ) { - std::cerr << "Saving of the entity subentities layer with " << DimensionsTag::value << " failed." << std::endl; + std::cerr << "Saving of the entity subentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -220,7 +226,7 @@ class MeshSubentityStorageLayer< MeshConfig, if( ! BaseType::load( file ) || ! this->subentitiesIndices.load( file ) ) { - std::cerr << "Loading of the entity subentities layer with " << DimensionsTag::value << " failed." << std::endl; + std::cerr << "Loading of the entity subentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -230,7 +236,7 @@ class MeshSubentityStorageLayer< MeshConfig, { BaseType::print( str ); str << std::endl; - str << "\t Subentities with " << DimensionsTag::value << " dimensions are: " << subentitiesIndices << "."; + str << "\t Subentities with " << DimensionTag::value << " dimensions are: " << subentitiesIndices << "."; } bool operator==( const MeshSubentityStorageLayer& layer ) const @@ -248,21 +254,21 @@ class MeshSubentityStorageLayer< MeshConfig, /**** * Define setter/getter for the current level of the subentities */ - void setSubentityIndex( DimensionsTag, + void setSubentityIndex( DimensionTag, const LocalIndexType localIndex, const GlobalIndexType globalIndex ) { this->subentitiesIndices[ localIndex ] = globalIndex; } - GlobalIndexType getSubentityIndex( DimensionsTag, + GlobalIndexType getSubentityIndex( DimensionTag, const LocalIndexType localIndex ) const { return this->subentitiesIndices[ localIndex ]; } using BaseType::subentityIdsArray; - IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; } + IdArrayType& subentityIdsArray( DimensionTag ) { return this->subentitiesIndices; } using BaseType::subentityOrientationsArray; void subentityOrientationsArray() {} @@ -273,15 +279,15 @@ class MeshSubentityStorageLayer< MeshConfig, template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > + typename DimensionTag > class MeshSubentityStorageLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, false, false > : public MeshSubentityStorageLayer< MeshConfig, EntityTopology, - typename DimensionsTag::Decrement > + typename DimensionTag::Decrement > { }; @@ -290,16 +296,16 @@ template< typename MeshConfig, typename EntityTopology > class MeshSubentityStorageLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, true, false > { - typedef MeshDimensionsTag< 0 > DimensionsTag; + typedef MeshDimensionTag< 0 > DimensionTag; protected: - static const int Dimensions = 0; + static const int Dimension = 0; typedef MeshTraits< MeshConfig > MeshTraitsType; - typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimensions > SubentityTraitsType; + typedef typename MeshTraitsType::template SubentityTraits< EntityTopology, Dimension > SubentityTraitsType; typedef typename MeshTraitsType::GlobalIndexType GlobalIndexType; typedef typename MeshTraitsType::LocalIndexType LocalIndexType; typedef typename SubentityTraitsType::IdArrayType IdArrayType; @@ -311,7 +317,7 @@ class MeshSubentityStorageLayer< MeshConfig, ~MeshSubentityStorageLayer() { - //cout << " Destroying " << this->sharedVerticesIndices.getSize() << " subentities with "<< DimensionsTag::value << " dimensions." << std::endl; + //cout << " Destroying " << this->sharedVerticesIndices.getSize() << " subentities with "<< DimensionTag::value << " dimensions." << std::endl; } @@ -325,7 +331,7 @@ class MeshSubentityStorageLayer< MeshConfig, { if( ! this->verticesIndices.save( file ) ) { - std::cerr << "Saving of the entity subentities layer with " << DimensionsTag::value << " failed." << std::endl; + std::cerr << "Saving of the entity subentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -335,7 +341,7 @@ class MeshSubentityStorageLayer< MeshConfig, { if( ! this->verticesIndices.load( file ) ) { - std::cerr << "Loading of the entity subentities layer with " << DimensionsTag::value << " failed." << std::endl; + std::cerr << "Loading of the entity subentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -343,7 +349,7 @@ class MeshSubentityStorageLayer< MeshConfig, void print( std::ostream& str ) const { - str << "\t Subentities with " << DimensionsTag::value << " dimensions are: " << this->verticesIndices << "."; + str << "\t Subentities with " << DimensionTag::value << " dimensions are: " << this->verticesIndices << "."; } bool operator==( const MeshSubentityStorageLayer& layer ) const @@ -351,19 +357,19 @@ class MeshSubentityStorageLayer< MeshConfig, return ( verticesIndices == layer.verticesIndices ); } - GlobalIndexType getSubentityIndex( DimensionsTag, + GlobalIndexType getSubentityIndex( DimensionTag, const LocalIndexType localIndex ) const { return this->verticesIndices[ localIndex ]; } - void setSubentityIndex( DimensionsTag, + void setSubentityIndex( DimensionTag, const LocalIndexType localIndex, const GlobalIndexType globalIndex ) { this->verticesIndices[ localIndex ] = globalIndex; } - IdArrayType& subentityIdsArray( DimensionsTag ) { return this->verticesIndices; } + IdArrayType& subentityIdsArray( DimensionTag ) { return this->verticesIndices; } protected: @@ -380,7 +386,7 @@ template< typename MeshConfig, typename EntityTopology > class MeshSubentityStorageLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< 0 >, + MeshDimensionTag< 0 >, false, false > { diff --git a/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccess.h b/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccess.h index 79c11d294c288a403862b5f1641ac7e2cca5ff16..44476c81cdb57ce40482ba63b5b62206176dfc8f 100644 --- a/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccess.h +++ b/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccess.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> @@ -17,9 +23,9 @@ namespace Meshes { template< typename MeshConfig, typename MeshEntity, - typename DimensionsTag, + typename DimensionTag, bool SuperentityStorage = - MeshTraits< MeshConfig >::template SuperentityTraits< MeshEntity, DimensionsTag::value >::storageEnabled > + MeshTraits< MeshConfig >::template SuperentityTraits< MeshEntity, DimensionTag::value >::storageEnabled > class MeshSuperentityAccessLayer; @@ -28,12 +34,12 @@ template< typename MeshConfig, class MeshSuperentityAccess : public MeshSuperentityAccessLayer< MeshConfig, MeshEntity, - MeshDimensionsTag< MeshTraits< MeshConfig >::meshDimensions > > + MeshDimensionTag< MeshTraits< MeshConfig >::meshDimension > > { public: typedef MeshSuperentityAccessLayer< MeshConfig, MeshEntity, - MeshDimensionsTag< MeshTraits< MeshConfig >::meshDimensions > > BaseType; + MeshDimensionTag< MeshTraits< MeshConfig >::meshDimension > > BaseType; bool operator == ( const MeshSuperentityAccess< MeshConfig, MeshEntity>& a ) const { return true; } // TODO: fix @@ -46,38 +52,38 @@ class MeshSuperentityAccess : template< typename MeshConfig, typename MeshEntity, - typename Dimensions > + typename Dimension > class MeshSuperentityAccessLayer< MeshConfig, MeshEntity, - Dimensions, + Dimension, true > : - public MeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement > + public MeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimension::Decrement > { - typedef MeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement > BaseType; + typedef MeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimension::Decrement > BaseType; public: typedef MeshTraits< MeshConfig > MeshTraitsType; - typedef typename MeshTraitsType::template SuperentityTraits< MeshEntity, Dimensions::value > SuperentityTraitsType; + typedef typename MeshTraitsType::template SuperentityTraits< MeshEntity, Dimension::value > SuperentityTraitsType; typedef typename MeshTraitsType::IdArrayAccessorType IdArrayAccessorType; typedef typename SuperentityTraitsType::StorageNetworkType StorageNetworkType; typedef typename SuperentityTraitsType::SuperentityAccessorType SuperentityAccessorType; //typedef typename StorageNetworkType::PortsType SuperentityAccessorType; using BaseType::superentityIds; - IdArrayAccessorType superentityIds( Dimensions ) const { return m_superentityIndices; } + IdArrayAccessorType superentityIds( Dimension ) const { return m_superentityIndices; } using BaseType::superentityIdsArray; - IdArrayAccessorType &superentityIdsArray( Dimensions ) { return m_superentityIndices; } + IdArrayAccessorType &superentityIdsArray( Dimension ) { return m_superentityIndices; } using BaseType::getSuperentityIndices; - const SuperentityAccessorType& getSuperentityIndices( Dimensions ) const + const SuperentityAccessorType& getSuperentityIndices( Dimension ) const { std::cerr << "###" << std::endl; return this->superentityIndices; } - SuperentityAccessorType& getSuperentityIndices( Dimensions ) + SuperentityAccessorType& getSuperentityIndices( Dimension ) { std::cerr << "######" << std::endl; return this->superentityIndices; @@ -85,12 +91,12 @@ class MeshSuperentityAccessLayer< MeshConfig, void print( std::ostream& str ) const { - str << "Superentities with " << Dimensions::value << " dimensions are: " << + str << "Superentities with " << Dimension::value << " dimensions are: " << this->superentityIndices << std::endl; BaseType::print( str ); } - //bool operator == ( const MeshSuperentityAccessLayer< MeshConfig, MeshEntity, Dimensions, tnlStorageTraits< true > >& l ) { return true; } // TODO: fix + //bool operator == ( const MeshSuperentityAccessLayer< MeshConfig, MeshEntity, Dimension, tnlStorageTraits< true > >& l ) { return true; } // TODO: fix private: IdArrayAccessorType m_superentityIndices; @@ -101,12 +107,12 @@ class MeshSuperentityAccessLayer< MeshConfig, template< typename MeshConfig, typename MeshEntity, - typename Dimensions > + typename Dimension > class MeshSuperentityAccessLayer< MeshConfig, MeshEntity, - Dimensions, + Dimension, false > : - public MeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement > + public MeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimension::Decrement > { }; @@ -114,7 +120,7 @@ template< typename MeshConfig, typename MeshEntity > class MeshSuperentityAccessLayer< MeshConfig, MeshEntity, - MeshDimensionsTag< MeshEntity::dimensions >, + MeshDimensionTag< MeshEntity::dimensions >, false > { protected: @@ -133,7 +139,7 @@ template< typename MeshConfig, typename MeshEntity > class MeshSuperentityAccessLayer< MeshConfig, MeshEntity, - MeshDimensionsTag< MeshEntity::dimensions >, + MeshDimensionTag< MeshEntity::dimensions >, true > { protected: diff --git a/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccessor.h b/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccessor.h index 80eb5c0ce5dd7cd048fe430090d6e6c2fea8b84b..ebe8ee41940190935657615eef3b95419def2d41 100644 --- a/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccessor.h +++ b/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityAccessor.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { diff --git a/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityStorageLayer.h b/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityStorageLayer.h index 82ba0cf1c294fdbe78f956e03ca2d31b82e70304..d02a1beafb69f6fbf1d86592c0dbc78f9dc4ce07 100644 --- a/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityStorageLayer.h +++ b/src/TNL/Meshes/MeshDetails/layers/MeshSuperentityStorageLayer.h @@ -8,10 +8,16 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/File.h> -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> #include <TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h> @@ -20,9 +26,9 @@ namespace Meshes { template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag, + typename DimensionTag, bool SuperentityStorage = - MeshSuperentityTraits< MeshConfig, EntityTopology, DimensionsTag::value >::storageEnabled > + MeshSuperentityTraits< MeshConfig, EntityTopology, DimensionTag::value >::storageEnabled > class MeshSuperentityStorageLayer; template< typename MeshConfig, @@ -30,22 +36,22 @@ template< typename MeshConfig, class MeshSuperentityStorageLayers : public MeshSuperentityStorageLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< MeshTraits< MeshConfig >::meshDimensions > > + MeshDimensionTag< MeshTraits< MeshConfig >::meshDimension > > { }; template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > -class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, true > - : public MeshSuperentityStorageLayer< MeshConfig, EntityTopology, typename DimensionsTag::Decrement > + typename DimensionTag > +class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionTag, true > + : public MeshSuperentityStorageLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement > { typedef - MeshSuperentityStorageLayer< MeshConfig, EntityTopology, typename DimensionsTag::Decrement > BaseType; + MeshSuperentityStorageLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement > BaseType; - static const int Dimensions = DimensionsTag::value; + static const int Dimension = DimensionTag::value; typedef MeshTraits< MeshConfig > MeshTraitsType; - typedef typename MeshTraitsType::template SuperentityTraits< EntityTopology, Dimensions > SuperentityTraitsType; + typedef typename MeshTraitsType::template SuperentityTraits< EntityTopology, Dimension > SuperentityTraitsType; protected: @@ -71,7 +77,7 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr /*~MeshSuperentityStorageLayer() { - std::cerr << " Destroying " << this->superentitiesIndices.getSize() << " superentities with "<< DimensionsTag::value << " dimensions." << std::endl; + std::cerr << " Destroying " << this->superentitiesIndices.getSize() << " superentities with "<< DimensionTag::value << " dimensions." << std::endl; std::cerr << " this->superentitiesIndices.getName() = " << this->superentitiesIndices.getName() << std::endl; std::cerr << " this->sharedSuperentitiesIndices.getName() = " << this->sharedSuperentitiesIndices.getName() << std::endl; }*/ @@ -87,7 +93,7 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr /**** * Define setter/getter for the current level of the superentities */ - bool setNumberOfSuperentities( DimensionsTag, + bool setNumberOfSuperentities( DimensionTag, const LocalIndexType size ) { if( ! this->superentitiesIndices.setSize( size ) ) @@ -97,30 +103,30 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr return true; } - LocalIndexType getNumberOfSuperentities( DimensionsTag ) const + LocalIndexType getNumberOfSuperentities( DimensionTag ) const { return this->superentitiesIndices.getSize(); } - void setSuperentityIndex( DimensionsTag, + void setSuperentityIndex( DimensionTag, const LocalIndexType localIndex, const GlobalIndexType globalIndex ) { this->superentitiesIndices[ localIndex ] = globalIndex; } - GlobalIndexType getSuperentityIndex( DimensionsTag, + GlobalIndexType getSuperentityIndex( DimensionTag, const LocalIndexType localIndex ) const { return this->superentitiesIndices[ localIndex ]; } - AccessArrayType& getSuperentitiesIndices( DimensionsTag ) + AccessArrayType& getSuperentitiesIndices( DimensionTag ) { return this->sharedSuperentitiesIndices; } - const AccessArrayType& getSuperentitiesIndices( DimensionsTag ) const + const AccessArrayType& getSuperentitiesIndices( DimensionTag ) const { return this->sharedSuperentitiesIndices; } @@ -130,7 +136,7 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr if( ! BaseType::save( file ) || ! this->superentitiesIndices.save( file ) ) { - //cerr << "Saving of the entity superentities layer with " << DimensionsTag::value << " failed." << std::endl; + //cerr << "Saving of the entity superentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -141,7 +147,7 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr if( ! BaseType::load( file ) || ! this->superentitiesIndices.load( file ) ) { - //cerr << "Loading of the entity superentities layer with " << DimensionsTag::value << " failed." << std::endl; + //cerr << "Loading of the entity superentities layer with " << DimensionTag::value << " failed." << std::endl; return false; } return true; @@ -150,7 +156,7 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr void print( std::ostream& str ) const { BaseType::print( str ); - str << std::endl << "\t Superentities with " << DimensionsTag::value << " dimensions are: " << this->superentitiesIndices << "."; + str << std::endl << "\t Superentities with " << DimensionTag::value << " dimensions are: " << this->superentitiesIndices << "."; } bool operator==( const MeshSuperentityStorageLayer& layer ) const @@ -171,13 +177,13 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr public: using BaseType::superentityIdsArray; - typename MeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag ) + typename MeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionTag ) { return this->superentitiesIndices; } using BaseType::getStorageNetwork; - StorageNetworkType& getStorageNetwork( DimensionsTag ) + StorageNetworkType& getStorageNetwork( DimensionTag ) { return this->storageNetwork; } @@ -185,9 +191,9 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, tr template< typename MeshConfig, typename EntityTopology, - typename DimensionsTag > -class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, false > - : public MeshSuperentityStorageLayer< MeshConfig, EntityTopology, typename DimensionsTag::Decrement > + typename DimensionTag > +class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionTag, false > + : public MeshSuperentityStorageLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement > { public: @@ -195,16 +201,16 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, DimensionsTag, fa template< typename MeshConfig, typename EntityTopology > -class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, MeshDimensionsTag< EntityTopology::dimensions >, false > +class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, MeshDimensionTag< EntityTopology::dimensions >, false > { - static const int Dimensions = EntityTopology::dimensions; - typedef MeshDimensionsTag< EntityTopology::dimensions > DimensionsTag; + static const int Dimension = EntityTopology::dimensions; + typedef MeshDimensionTag< EntityTopology::dimensions > DimensionTag; - typedef MeshSuperentityTraits< MeshConfig, EntityTopology, Dimensions > SuperentityTraits; + typedef MeshSuperentityTraits< MeshConfig, EntityTopology, Dimension > SuperentityTraits; typedef MeshSuperentityStorageLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, false > ThisType; protected: @@ -218,12 +224,12 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, MeshDimensionsTag /**** * These methods are due to 'using BaseType::...;' in the derived classes. */ - bool setNumberOfSuperentities( DimensionsTag, + bool setNumberOfSuperentities( DimensionTag, const LocalIndexType size ); - LocalIndexType getNumberOfSuperentities( DimensionsTag ) const; - GlobalIndexType getSuperentityIndex( DimensionsTag, + LocalIndexType getNumberOfSuperentities( DimensionTag ) const; + GlobalIndexType getSuperentityIndex( DimensionTag, const LocalIndexType localIndex ){} - void setSuperentityIndex( DimensionsTag, + void setSuperentityIndex( DimensionTag, const LocalIndexType localIndex, const GlobalIndexType globalIndex ) {} @@ -248,13 +254,13 @@ class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, MeshDimensionsTag return true; } - typename MeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag ) + typename MeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionTag ) { TNL_ASSERT( false, ); //return this->superentitiesIndices; } - StorageNetworkType& getStorageNetwork( DimensionsTag ) + StorageNetworkType& getStorageNetwork( DimensionTag ) { TNL_ASSERT( false, ); //return this->storageNetwork; @@ -266,18 +272,18 @@ template< typename MeshConfig, typename EntityTopology > class MeshSuperentityStorageLayer< MeshConfig, EntityTopology, - MeshDimensionsTag< EntityTopology::dimensions >, + MeshDimensionTag< EntityTopology::dimensions >, true > { - static const int Dimensions = EntityTopology::dimensions; - typedef MeshDimensionsTag< Dimensions > DimensionsTag; + static const int Dimension = EntityTopology::dimensions; + typedef MeshDimensionTag< Dimension > DimensionTag; typedef MeshSuperentityTraits< MeshConfig, EntityTopology, - Dimensions > SuperentityTraits; + Dimension > SuperentityTraits; typedef MeshSuperentityStorageLayer< MeshConfig, EntityTopology, - DimensionsTag, + DimensionTag, true > ThisType; protected: @@ -291,12 +297,12 @@ class MeshSuperentityStorageLayer< MeshConfig, /**** * These methods are due to 'using BaseType::...;' in the derived classes. */ - bool setNumberOfSuperentities( DimensionsTag, + bool setNumberOfSuperentities( DimensionTag, const LocalIndexType size ); - LocalIndexType getNumberOfSuperentities( DimensionsTag ) const; - GlobalIndexType getSuperentityIndex( DimensionsTag, + LocalIndexType getNumberOfSuperentities( DimensionTag ) const; + GlobalIndexType getSuperentityIndex( DimensionTag, const LocalIndexType localIndex ){} - void setSuperentityIndex( DimensionsTag, + void setSuperentityIndex( DimensionTag, const LocalIndexType localIndex, const GlobalIndexType globalIndex ) {} @@ -321,13 +327,13 @@ class MeshSuperentityStorageLayer< MeshConfig, return true; } - typename MeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionsTag ) + typename MeshTraits< MeshConfig >::GlobalIdArrayType& superentityIdsArray( DimensionTag ) { TNL_ASSERT( false, ); //return this->superentitiesIndices; } - StorageNetworkType& getStorageNetwork( DimensionsTag ) + StorageNetworkType& getStorageNetwork( DimensionTag ) { TNL_ASSERT( false, ); //return this->storageNetwork; diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h index b6d31f6a395faf9b746958e1cf1c9df28c2c2201..c8c8be6b9a5c45dea478cacfa349d4525d82aad9 100644 --- a/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h +++ b/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Containers/StaticVector.h> @@ -28,26 +34,26 @@ template< typename MeshConfig, typename EntityTopology > class MeshEntitySeedKey template< typename MeshConfig, typename EntityTopology > class MeshEntityReferenceOrientation; template< typename MeshConfig, - typename DimensionsTag, - typename SuperDimensionsTag = MeshDimensionsTag< MeshConfig::meshDimensions > > + typename DimensionTag, + typename SuperDimensionTag = MeshDimensionTag< MeshConfig::meshDimension > > class MeshEntityOrientationNeeded { - static_assert( 0 <= DimensionsTag::value && DimensionsTag::value < MeshConfig::CellTopology::dimensions, "invalid dimensions" ); - static_assert( DimensionsTag::value < SuperDimensionsTag::value && SuperDimensionsTag::value <= MeshConfig::CellTopology::dimensions, "invalid superentity dimensions"); + static_assert( 0 <= DimensionTag::value && DimensionTag::value < MeshConfig::CellTopology::dimensions, "invalid dimensions" ); + static_assert( DimensionTag::value < SuperDimensionTag::value && SuperDimensionTag::value <= MeshConfig::CellTopology::dimensions, "invalid superentity dimension"); - typedef typename MeshTraits< MeshConfig >::template EntityTraits< SuperDimensionsTag::value >::EntityTopology SuperentityTopology; + typedef typename MeshTraits< MeshConfig >::template EntityTraits< SuperDimensionTag::value >::EntityTopology SuperentityTopology; - static const bool previousSuperDimensionsValue = MeshEntityOrientationNeeded< MeshConfig, DimensionsTag, typename SuperDimensionsTag::Decrement >::value; - static const bool thisSuperDimensionsValue = MeshTraits< MeshConfig >::template SubentityTraits< SuperentityTopology, DimensionsTag::value >::orientationEnabled; + static const bool previousSuperDimensionValue = MeshEntityOrientationNeeded< MeshConfig, DimensionTag, typename SuperDimensionTag::Decrement >::value; + static const bool thisSuperDimensionValue = MeshTraits< MeshConfig >::template SubentityTraits< SuperentityTopology, DimensionTag::value >::orientationEnabled; public: - static const bool value = ( previousSuperDimensionsValue || thisSuperDimensionsValue ); + static const bool value = ( previousSuperDimensionValue || thisSuperDimensionValue ); }; -template< typename MeshConfig, typename DimensionsTag > -class MeshEntityOrientationNeeded< MeshConfig, DimensionsTag, DimensionsTag > +template< typename MeshConfig, typename DimensionTag > +class MeshEntityOrientationNeeded< MeshConfig, DimensionTag, DimensionTag > { - static_assert( 0 <= DimensionsTag::value && DimensionsTag::value <= MeshConfig::CellTopology::dimensions, "invalid dimensions" ); + static_assert( 0 <= DimensionTag::value && DimensionTag::value <= MeshConfig::CellTopology::dimensions, "invalid dimensions" ); public: static const bool value = false; @@ -55,17 +61,17 @@ class MeshEntityOrientationNeeded< MeshConfig, DimensionsTag, DimensionsTag > template< typename MeshConfig, - int Dimensions > + int Dimension > class MeshEntityTraits { public: - static const bool storageEnabled = MeshConfig::entityStorage( Dimensions ); - static const bool orientationNeeded = MeshEntityOrientationNeeded< MeshConfig, MeshDimensionsTag< Dimensions > >::value; + static const bool storageEnabled = MeshConfig::entityStorage( Dimension ); + static const bool orientationNeeded = MeshEntityOrientationNeeded< MeshConfig, MeshDimensionTag< Dimension > >::value; typedef typename MeshConfig::GlobalIndexType GlobalIndexType; typedef typename MeshConfig::LocalIndexType LocalIndexType; - typedef typename MeshEntityTopology< MeshConfig, Dimensions >::Topology EntityTopology; + typedef typename MeshEntityTopology< MeshConfig, Dimension >::Topology EntityTopology; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h index 9ff9103bf4a6cf02920b09e0cbb2067f741bd080..cbdd144932f6509f14082ea4d7981ba3e3ee47bf 100644 --- a/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h +++ b/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Containers/StaticArray.h> @@ -23,16 +29,16 @@ template< typename MeshConfig, typename EntityTopology > class MeshEntityOrienta template< typename MeshConfig, typename EntityTopology, - int Dimensions > + int Dimension > class MeshSubentityTraits { public: - static const bool storageEnabled = MeshConfig::subentityStorage( EntityTopology(), Dimensions ); - static const bool orientationEnabled = MeshConfig::subentityOrientationStorage( EntityTopology(), Dimensions ); + static const bool storageEnabled = MeshConfig::subentityStorage( EntityTopology(), Dimension ); + static const bool orientationEnabled = MeshConfig::subentityOrientationStorage( EntityTopology(), Dimension ); typedef typename MeshConfig::GlobalIndexType GlobalIndexType; typedef typename MeshConfig::LocalIndexType LocalIndexType; - typedef MeshSubtopology< EntityTopology, Dimensions > Subtopology; + typedef MeshSubtopology< EntityTopology, Dimension > Subtopology; typedef typename Subtopology::Topology SubentityTopology; typedef MeshEntity< MeshConfig, SubentityTopology > SubentityType; typedef MeshEntitySeed< MeshConfig, SubentityTopology > Seed; @@ -52,16 +58,16 @@ class MeshSubentityTraits typedef Containers::StaticArray< count, LocalIndexType > IdPermutationArrayType; template< LocalIndexType subentityIndex, - LocalIndexType subentityVertexIndex > - struct Vertex + LocalIndexType subentityPointIndex > + struct Point { - enum { index = tnlSubentityVertex< EntityTopology, + enum { index = tnlSubentityPoint< EntityTopology, SubentityTopology, subentityIndex, - subentityVertexIndex>::index }; + subentityPointIndex>::index }; }; - static_assert( EntityTopology::dimensions > Dimensions, "You try to create subentities traits where subentity dimensions are not smaller than the entity dimensions." ); + static_assert( EntityTopology::dimensions > Dimension, "You try to create subentities traits where subentity dimension are not smaller than the entity dimension." ); }; } // namespace Meshes diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h index 1f2739e3fd4da1b51b498e6b56e4c9bd8ae24790..b4e816399673a2a71ddcc46bac1e273923afdea8 100644 --- a/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h +++ b/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Containers/Array.h> @@ -25,7 +31,7 @@ namespace Meshes { template< typename MeshConfig, typename EntityTopology, - int Dimensions > + int Dimension > class MeshSuperentityTraits { public: @@ -34,10 +40,10 @@ class MeshSuperentityTraits typedef typename MeshConfig::LocalIndexType LocalIndexType; - static const bool storageEnabled = MeshConfig::template superentityStorage< EntityTopology >( EntityTopology(), Dimensions ); + static const bool storageEnabled = MeshConfig::template superentityStorage< EntityTopology >( EntityTopology(), Dimension ); //typedef tnlStorageTraits< storageEnabled > SuperentityStorageTag; typedef MeshEntity< MeshConfig, EntityTopology > EntityType; - typedef MeshEntityTraits< MeshConfig, Dimensions > EntityTraits; + typedef MeshEntityTraits< MeshConfig, Dimension > EntityTraits; typedef typename EntityTraits::EntityTopology SuperentityTopology; typedef typename EntityTraits::EntityType SuperentityType; diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h index 8bfca4c14c22ba0ee99ad6a0a80a48bde7446303..4cd115593b534804fd9815f466214388f6556cfa 100644 --- a/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h +++ b/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h @@ -8,13 +8,19 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Containers/StaticVector.h> #include <TNL/Containers/Array.h> #include <TNL/Containers/SharedArray.h> #include <TNL/Containers/ConstSharedArray.h> -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> namespace TNL { namespace Meshes { @@ -22,9 +28,9 @@ namespace Meshes { struct MeshVertexTopology; template< typename MeshConfig, typename EntityTopology > class MeshEntity; template< typename MeshConfig, typename EntityTopology > class MeshEntitySeed; -template< typename MeshConfig, int Dimensions > class MeshEntityTraits; -template< typename MeshConfig, typename MeshEntity, int SubDimensions > class MeshSubentityTraits; -template< typename MeshConfig, typename MeshEntity, int SuperDimensions > class MeshSuperentityTraits; +template< typename MeshConfig, int Dimension > class MeshEntityTraits; +template< typename MeshConfig, typename MeshEntity, int SubDimension > class MeshSubentityTraits; +template< typename MeshConfig, typename MeshEntity, int SuperDimension > class MeshSuperentityTraits; template< typename MeshConfig, typename Device = Devices::Host > @@ -32,8 +38,8 @@ class MeshTraits { public: - static const int meshDimensions = MeshConfig::CellTopology::dimensions; - static const int worldDimensions = MeshConfig::worldDimensions; + static const int meshDimension = MeshConfig::CellTopology::dimensions; + static const int worldDimension = MeshConfig::worldDimension; typedef Device DeviceType; typedef typename MeshConfig::GlobalIndexType GlobalIndexType; @@ -42,7 +48,7 @@ class MeshTraits typedef typename MeshConfig::CellTopology CellTopology; typedef MeshEntity< MeshConfig, CellTopology > CellType; typedef MeshEntity< MeshConfig, MeshVertexTopology > VertexType; - typedef Containers::StaticVector< worldDimensions, typename MeshConfig::RealType > PointType; + typedef Containers::StaticVector< worldDimension, typename MeshConfig::RealType > PointType; typedef MeshEntitySeed< MeshConfig, CellTopology > CellSeedType; typedef Containers::Array< PointType, Devices::Host, GlobalIndexType > PointArrayType; @@ -51,17 +57,17 @@ class MeshTraits typedef Containers::tnlConstSharedArray< GlobalIndexType, Devices::Host, LocalIndexType > IdArrayAccessorType; typedef Containers::tnlConstSharedArray< LocalIndexType, Devices::Host, LocalIndexType > IdPermutationArrayAccessorType; - template< int Dimensions > using EntityTraits = - MeshEntityTraits< MeshConfig, Dimensions >; + template< int Dimension > using EntityTraits = + MeshEntityTraits< MeshConfig, Dimension >; - template< typename EntityTopology, int SubDimensions > using SubentityTraits = - MeshSubentityTraits< MeshConfig, EntityTopology, SubDimensions >; + template< typename EntityTopology, int SubDimension > using SubentityTraits = + MeshSubentityTraits< MeshConfig, EntityTopology, SubDimension >; - template< typename EntityTopology, int SuperDimensions > using SuperentityTraits = - MeshSuperentityTraits< MeshConfig, EntityTopology, SuperDimensions >; + template< typename EntityTopology, int SuperDimension > using SuperentityTraits = + MeshSuperentityTraits< MeshConfig, EntityTopology, SuperDimension >; - typedef MeshDimensionsTag< meshDimensions > DimensionsTag; + typedef MeshDimensionTag< meshDimension > DimensionTag; }; diff --git a/src/TNL/Meshes/MeshDimensionsTag.h b/src/TNL/Meshes/MeshDimensionTag.h similarity index 75% rename from src/TNL/Meshes/MeshDimensionsTag.h rename to src/TNL/Meshes/MeshDimensionTag.h index 3f29b03ae56db4645e3b24480a99b4ef33a7f24d..10dbcdaf71605a627f29154074dd1e76d0cc0df9 100644 --- a/src/TNL/Meshes/MeshDimensionsTag.h +++ b/src/TNL/Meshes/MeshDimensionTag.h @@ -1,5 +1,5 @@ /*************************************************************************** - MeshDimensionsTag.h - description + MeshDimensionTag.h - description ------------------- begin : Feb 11, 2014 copyright : (C) 2014 by Tomas Oberhuber @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Assert.h> @@ -26,25 +32,25 @@ namespace Meshes { * Therefore one cannot specialize the mesh layers just by integers saying the mesh * layer dimensions but instead this tag must be used. This makes the code more difficult * to read and we would like to avoid it if it is possible sometime. - * On the other hand, MeshDimensionsTag is also used for method overloading when + * On the other hand, MeshDimensionTag is also used for method overloading when * asking for different mesh entities. In this case it makes sense and it cannot be * replaced. */ -template< int Dimensions > -class MeshDimensionsTag +template< int Dimension > +class MeshDimensionTag { public: - static const int value = Dimensions; + static const int value = Dimension; - typedef MeshDimensionsTag< Dimensions - 1 > Decrement; + typedef MeshDimensionTag< Dimension - 1 > Decrement; static_assert( value >= 0, "The value of the dimensions cannot be negative." ); }; template<> -class MeshDimensionsTag< 0 > +class MeshDimensionTag< 0 > { public: diff --git a/src/TNL/Meshes/MeshEntity.h b/src/TNL/Meshes/MeshEntity.h index 9f188a8b316f2e9e1284d507b53a53e8828ea952..0aedeb356d1074741efcc6ebaef1bb6a0334b261 100644 --- a/src/TNL/Meshes/MeshEntity.h +++ b/src/TNL/Meshes/MeshEntity.h @@ -8,13 +8,19 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/File.h> #include <TNL/Containers/DynamicTypeTag.h> #include <TNL/Meshes/MeshDetails/MeshEntityId.h> #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> -#include <TNL/Meshes/MeshDimensionsTag.h> +#include <TNL/Meshes/MeshDimensionTag.h> #include <TNL/Meshes/Topologies/MeshVertexTopology.h> #include <TNL/Meshes/MeshDetails/layers/MeshSubentityStorageLayer.h> #include <TNL/Meshes/MeshDetails/layers/MeshSuperentityStorageLayer.h> @@ -47,8 +53,8 @@ class MeshEntity template< int Subdimensions > using SubentityTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, Subdimensions >; - template< int SuperDimensions > using SuperentityTraits = - typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperDimensions >; + template< int SuperDimension > using SuperentityTraits = + typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperDimension >; MeshEntity( const SeedType& entitySeed ); @@ -68,7 +74,7 @@ class MeshEntity bool operator==( const MeshEntity& entity ) const; - constexpr int getEntityDimensions() const; + constexpr int getEntityDimension() const; /**** * Subentities @@ -91,17 +97,17 @@ class MeshEntity /**** * Superentities */ - template< int SuperDimensions > + template< int SuperDimension > LocalIndexType getNumberOfSuperentities() const; - template< int SuperDimensions > + template< int SuperDimension > GlobalIndexType getSuperentityIndex( const LocalIndexType localIndex ) const; - template< int SuperDimensions > - typename SuperentityTraits< SuperDimensions >::AccessArrayType& getSuperentitiesIndices(); + template< int SuperDimension > + typename SuperentityTraits< SuperDimension >::AccessArrayType& getSuperentitiesIndices(); - template< int SuperDimensions > - const typename SuperentityTraits< SuperDimensions >::AccessArrayType& getSuperentitiesIndices() const; + template< int SuperDimension > + const typename SuperentityTraits< SuperDimension >::AccessArrayType& getSuperentitiesIndices() const; /**** * Vertices @@ -114,7 +120,7 @@ class MeshEntity const typename SubentityTraits< 0 >::AccessArrayType& getVerticesIndices() const; - template< int Dimensions > + template< int Dimension > IdPermutationArrayAccessorType subentityOrientation( LocalIndexType index ) const; protected: @@ -162,8 +168,8 @@ class MeshEntity< MeshConfig, MeshVertexTopology > typedef typename MeshTraitsType::IdPermutationArrayAccessorType IdPermutationArrayAccessorType; typedef MeshEntitySeed< MeshConfig, EntityTopology > SeedType; - template< int SuperDimensions > using SuperentityTraits = - typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperDimensions >; + template< int SuperDimension > using SuperentityTraits = + typename MeshTraitsType::template SuperentityTraits< EntityTopology, SuperDimension >; static String getType(); @@ -179,7 +185,7 @@ class MeshEntity< MeshConfig, MeshVertexTopology > bool operator==( const MeshEntity& entity ) const; - constexpr int getEntityDimensions() const; + constexpr int getEntityDimension() const; template< int Superdimensions > LocalIndexType getNumberOfSuperentities() const; @@ -189,7 +195,7 @@ class MeshEntity< MeshConfig, MeshVertexTopology > template< int Superdimensions > const typename SuperentityTraits< Superdimensions >::AccessArrayType& getSuperentitiesIndeces() const; - template< int Dimensions > + template< int Dimension > GlobalIndexType getSuperentityIndex( const LocalIndexType localIndex ) const; /**** diff --git a/src/TNL/Meshes/Topologies/MeshEdgeTopology.h b/src/TNL/Meshes/Topologies/MeshEdgeTopology.h index 1edb84a262f5d429088ed0dbb2b41807c7ed8c1f..34e8778baa434e444a50e01068d06812e44992d1 100644 --- a/src/TNL/Meshes/Topologies/MeshEdgeTopology.h +++ b/src/TNL/Meshes/Topologies/MeshEdgeTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/Topologies/MeshEntityTopology.h> diff --git a/src/TNL/Meshes/Topologies/MeshEntityTopology.h b/src/TNL/Meshes/Topologies/MeshEntityTopology.h index 306e138d1b84f4aca72e760f6ba858c88593f7d1..589bec5db38d2cc7a406b8abd3092251f8247628 100644 --- a/src/TNL/Meshes/Topologies/MeshEntityTopology.h +++ b/src/TNL/Meshes/Topologies/MeshEntityTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { @@ -27,13 +33,13 @@ struct tnlSubentityVertex; template< typename MeshConfig, - int Dimensions > + int Dimension > class MeshEntityTopology { public: typedef typename MeshSubtopology< typename MeshConfig::CellTopology, - Dimensions >::Topology Topology; + Dimension >::Topology Topology; }; template< typename MeshConfig > diff --git a/src/TNL/Meshes/Topologies/MeshHexahedronTopology.h b/src/TNL/Meshes/Topologies/MeshHexahedronTopology.h index 7a3e08a9991d2ed60d4ff34fccf72fd0e96e41ae..4dc1ff3acae2a5579885bf00963150d86cc52844 100644 --- a/src/TNL/Meshes/Topologies/MeshHexahedronTopology.h +++ b/src/TNL/Meshes/Topologies/MeshHexahedronTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/Topologies/MeshQuadrilateralTopology.h> diff --git a/src/TNL/Meshes/Topologies/MeshQuadrilateralTopology.h b/src/TNL/Meshes/Topologies/MeshQuadrilateralTopology.h index bb650528beca40aa35d9a877cb6590dd6ede8000..4dd844e4c9c0b3bd195c9f3387f8bbfa7d3557e2 100644 --- a/src/TNL/Meshes/Topologies/MeshQuadrilateralTopology.h +++ b/src/TNL/Meshes/Topologies/MeshQuadrilateralTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/Topologies/MeshEdgeTopology.h> diff --git a/src/TNL/Meshes/Topologies/MeshSimplexTopology.h b/src/TNL/Meshes/Topologies/MeshSimplexTopology.h index e331db4d945b2242607968784e32ca99fcdad7a2..2120a71c7a120ab996e4b68777bcea99bfad5e22 100644 --- a/src/TNL/Meshes/Topologies/MeshSimplexTopology.h +++ b/src/TNL/Meshes/Topologies/MeshSimplexTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once diff --git a/src/TNL/Meshes/Topologies/MeshSubtopology.h b/src/TNL/Meshes/Topologies/MeshSubtopology.h index 8f522299dead491890eb200d283e55962cf20e3f..df9d813302025b4f6373f6ff4dc2f032b72a96ba 100644 --- a/src/TNL/Meshes/Topologies/MeshSubtopology.h +++ b/src/TNL/Meshes/Topologies/MeshSubtopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { diff --git a/src/TNL/Meshes/Topologies/MeshTetrahedronTopology.h b/src/TNL/Meshes/Topologies/MeshTetrahedronTopology.h index fc881e6d79c5581ac5595804a80485d55d7a58c8..4f0067c255af28cf33d2dc4c5140053dbc8c8052 100644 --- a/src/TNL/Meshes/Topologies/MeshTetrahedronTopology.h +++ b/src/TNL/Meshes/Topologies/MeshTetrahedronTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/Topologies/MeshTriangleTopology.h> diff --git a/src/TNL/Meshes/Topologies/MeshTriangleTopology.h b/src/TNL/Meshes/Topologies/MeshTriangleTopology.h index 4b693014675108b573fe2147f5dbf35c23c90447..0305c4355cc289548bf8fe3381f9fd08c71b513a 100644 --- a/src/TNL/Meshes/Topologies/MeshTriangleTopology.h +++ b/src/TNL/Meshes/Topologies/MeshTriangleTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once #include <TNL/Meshes/Topologies/MeshEdgeTopology.h> diff --git a/src/TNL/Meshes/Topologies/MeshVertexTopology.h b/src/TNL/Meshes/Topologies/MeshVertexTopology.h index 4a8e48b67ebb29770fefcae35dc061368524cff0..5c70978f74687cf8999dd91b1ae811d1e8db9410 100644 --- a/src/TNL/Meshes/Topologies/MeshVertexTopology.h +++ b/src/TNL/Meshes/Topologies/MeshVertexTopology.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Zabka Vitezslav, zabkav@gmail.com + */ + #pragma once namespace TNL { diff --git a/src/TNL/Meshes/Traverser.h b/src/TNL/Meshes/Traverser.h index 3350d7b1b16af58515c9b1e662242987a05fcca9..206227e9b360a2beaf5fccb8ce4ec26aadec375e 100644 --- a/src/TNL/Meshes/Traverser.h +++ b/src/TNL/Meshes/Traverser.h @@ -15,7 +15,7 @@ namespace Meshes { template< typename Mesh, typename MeshEntity, - int EntitiesDimensions = MeshEntity::entityDimensions > + int EntitiesDimension = MeshEntity::entityDimension > class Traverser{}; } // namespace Meshes diff --git a/src/TNL/Operators/DirichletBoundaryConditions.h b/src/TNL/Operators/DirichletBoundaryConditions.h index 0e50373b7fcecd45472fa5f4275a0f3b13e8eae6..bd2d54739250d80bf493aace2d22e267cf11adc6 100644 --- a/src/TNL/Operators/DirichletBoundaryConditions.h +++ b/src/TNL/Operators/DirichletBoundaryConditions.h @@ -19,15 +19,15 @@ namespace TNL { namespace Operators { template< typename Mesh, - typename Function = Functions::Analytic::Constant< Mesh::getMeshDimensions(), typename Mesh::RealType >, - int MeshEntitiesDimensions = Mesh::getMeshDimensions(), + typename Function = Functions::Analytic::Constant< Mesh::getMeshDimension(), typename Mesh::RealType >, + int MeshEntitiesDimension = Mesh::getMeshDimension(), typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class DirichletBoundaryConditions : public Operator< Mesh, Functions::MeshBoundaryDomain, - MeshEntitiesDimensions, - MeshEntitiesDimensions, + MeshEntitiesDimension, + MeshEntitiesDimension, Real, Index > { @@ -41,9 +41,9 @@ class DirichletBoundaryConditions typedef SharedPointer< Mesh > MeshPointer; typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; - static constexpr int getMeshDimensions() { return MeshType::meshDimensions; } + static constexpr int getDimension() { return MeshType::meshDimension; } static void configSetup( Config::ConfigDescription& config, const String& prefix = "" ) @@ -80,7 +80,7 @@ class DirichletBoundaryConditions const EntityType& entity, const RealType& time = 0 ) const { - //static_assert( EntityType::getDimensions() == MeshEntitiesDimensions, "Wrong mesh entity dimensions." ); + //static_assert( EntityType::getDimension() == MeshEntitiesDimension, "Wrong mesh entity dimension." ); return Functions::FunctionAdapter< MeshType, Function >::template getValue( this->function, entity, time ); } diff --git a/src/TNL/Operators/ExactFunctionInverseOperator.h b/src/TNL/Operators/ExactFunctionInverseOperator.h index dca0666ab6889e1b4d016f53b8a89d747f8cdb47..7833d05445fd6c49f0971a5c57c0d7c4cdcea37c 100644 --- a/src/TNL/Operators/ExactFunctionInverseOperator.h +++ b/src/TNL/Operators/ExactFunctionInverseOperator.h @@ -18,17 +18,17 @@ namespace TNL { namespace Operators { -template< int Dimensions, - typename InnerOperator= ExactIdentityOperator< Dimensions > > +template< int Dimension, + typename InnerOperator= ExactIdentityOperator< Dimension > > class ExactFunctionInverseOperator - : public Functions::Domain< Dimensions, Functions::SpaceDomain > + : public Functions::Domain< Dimension, Functions::SpaceDomain > { public: static String getType() { return String( "ExactFunctionInverseOperator< " ) + - String( Dimensions) + " >"; + String( Dimension) + " >"; } InnerOperator& getInnerOperator() @@ -45,7 +45,7 @@ class ExactFunctionInverseOperator __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { typedef typename Function::RealType RealType; @@ -59,7 +59,7 @@ class ExactFunctionInverseOperator __cuda_callable__ typename Function::RealType getPartialDerivative( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0, diff --git a/src/TNL/Operators/ExactIdentityOperator.h b/src/TNL/Operators/ExactIdentityOperator.h index ee7ea78304f1996aef915ba760410c539d20944e..7c39938df87fb6a1863d82ea13d54e2e4e482c1a 100644 --- a/src/TNL/Operators/ExactIdentityOperator.h +++ b/src/TNL/Operators/ExactIdentityOperator.h @@ -17,23 +17,23 @@ namespace TNL { namespace Operators { -template< int Dimensions > +template< int Dimension > class ExactIdentityOperator - : public Functions::Domain< Dimensions, Functions::SpaceDomain > + : public Functions::Domain< Dimension, Functions::SpaceDomain > { public: static String getType() { return String( "ExactIdentityOperator< " ) + - String( Dimensions) + " >"; + String( Dimension) + " >"; } template< typename Function > __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { return function( v, time ); @@ -46,7 +46,7 @@ class ExactIdentityOperator __cuda_callable__ typename Function::RealType getPartialDerivative( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0, diff --git a/src/TNL/Operators/ExactOperatorComposition.h b/src/TNL/Operators/ExactOperatorComposition.h index b2d487832563ee501fed1a8e9bf214c552230603..e1a3ca6230402269aea0113a9666d043be0f2d43 100644 --- a/src/TNL/Operators/ExactOperatorComposition.h +++ b/src/TNL/Operators/ExactOperatorComposition.h @@ -22,7 +22,7 @@ class ExactOperatorComposition template< typename Function > __cuda_callable__ inline typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { return OuterOperator( innerOperator( function, v, time), v, time ); diff --git a/src/TNL/Operators/FiniteDifferences_impl.h b/src/TNL/Operators/FiniteDifferences_impl.h index 51cc742999d7fc40bdb2e5fd75363ecc3ec6a335..3d5b5bace6fa1cd9d9566581fbe113ebba06437d 100644 --- a/src/TNL/Operators/FiniteDifferences_impl.h +++ b/src/TNL/Operators/FiniteDifferences_impl.h @@ -69,22 +69,22 @@ Real FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >::getDifference( if( YDifferenceOrder > 0 || ZDifferenceOrder > 0 ) return 0.0; const RealType hx = grid.getSpaceSteps().x(); - auto neighbourEntities = cell.getNeighbourEntities(); + auto neighborEntities = cell.getNeighborEntities(); IndexType cellIndex = grid.getEntityIndex( cell ); if( XDifferenceOrder == 1 ) { if( XDifferenceDirection == 0 ) - return ( function[ neighbourEntities.template getEntityIndex< 1 >() ] - - function[ neighbourEntities.template getEntityIndex< -1 >() ] ) / ( 2.0 * hx ); + return ( function[ neighborEntities.template getEntityIndex< 1 >() ] - + function[ neighborEntities.template getEntityIndex< -1 >() ] ) / ( 2.0 * hx ); else - return ( function[ neighbourEntities.template getEntityIndex< XDifferenceDirection >() ] - + return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection >() ] - function[ cellIndex ] ) / ( XDifferenceDirection * hx ); } if( XDifferenceOrder == 2 ) { - return ( function[ neighbourEntities.template getEntityIndex< 1 >() ] - + return ( function[ neighborEntities.template getEntityIndex< 1 >() ] - 2.0 * function[ cellIndex ] + - function[ neighbourEntities.template getEntityIndex< -1 >() ] ) / ( hx * hx ); + function[ neighborEntities.template getEntityIndex< -1 >() ] ) / ( hx * hx ); } } @@ -121,33 +121,33 @@ Real FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >::getDifference( { if( ZDifferenceOrder > 0 ) return 0.0; - auto neighbourEntities = cell.getNeighbourEntities(); + auto neighborEntities = cell.getNeighborEntities(); IndexType cellIndex = grid.getEntityIndex( cell ); if( XDifferenceOrder == 1 ) { const RealType hx = grid.getSpaceSteps().x(); - return ( function[ neighbourEntities.template getEntityIndex< XDifferenceDirection, 0 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection, 0 >( cellIndex ) ] - function[ cellIndex ] ) / ( XDifferenceDirection * hx ); } if( XDifferenceOrder == 2 ) { const RealType hx = grid.getSpaceSteps().x(); - return ( function[ neighbourEntities.template getEntityIndex< 1, 0 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 1, 0 >( cellIndex ) ] - 2.0 * function[ cellIndex ] + - function[ neighbourEntities.template getEntityIndex< -1, 0 >( cellIndex ) ] ) / ( hx * hx ); + function[ neighborEntities.template getEntityIndex< -1, 0 >( cellIndex ) ] ) / ( hx * hx ); } if( YDifferenceOrder == 1 ) { const RealType hy = grid.getSpaceSteps().y(); - return ( function[ neighbourEntities.template getEntityIndex< 0, YDifferenceDirection >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 0, YDifferenceDirection >( cellIndex ) ] - function[ cellIndex ] ) / ( YDifferenceDirection * hy ); } if( YDifferenceOrder == 2 ) { const RealType hy = grid.getSpaceSteps().y(); - return ( function[ neighbourEntities.template getEntityIndex< 0, 1 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 0, 1 >( cellIndex ) ] - 2.0 * function[ cellIndex ] + - function[ neighbourEntities.template getEntityIndex< 0, -1 >( cellIndex ) ] ) / ( hy * hy ); + function[ neighborEntities.template getEntityIndex< 0, -1 >( cellIndex ) ] ) / ( hy * hy ); } @@ -184,47 +184,47 @@ Real FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >::getDifference( const CellType& cell, const GridFunction& function ) { - auto neighbourEntities = cell.getNeighbourEntities(); + auto neighborEntities = cell.getNeighborEntities(); IndexType cellIndex = grid.getEntityIndex( cell ); if( XDifferenceOrder == 1 ) { const RealType hx = grid.getSpaceSteps().x(); - return ( function[ neighbourEntities.template getEntityIndex< XDifferenceDirection, 0, 0 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection, 0, 0 >( cellIndex ) ] - function[ cellIndex ] ) / ( XDifferenceDirection * hx ); } if( XDifferenceOrder == 2 ) { const RealType hx = grid.getSpaceSteps().x(); - return ( function[ neighbourEntities.template getEntityIndex< 1, 0, 0 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 1, 0, 0 >( cellIndex ) ] - 2.0 * function[ cellIndex ] + - function[ neighbourEntities.template getEntityIndex< -1, 0, 0 >( cellIndex ) ] ) / ( hx * hx ); + function[ neighborEntities.template getEntityIndex< -1, 0, 0 >( cellIndex ) ] ) / ( hx * hx ); } if( YDifferenceOrder == 1 ) { const RealType hy = grid.getSpaceSteps().y(); - return ( function[ neighbourEntities.template getEntityIndex< 0, YDifferenceDirection, 0 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 0, YDifferenceDirection, 0 >( cellIndex ) ] - function[ cellIndex ] ) / ( YDifferenceDirection * hy ); } if( YDifferenceOrder == 2 ) { const RealType hy = grid.getSpaceSteps().y(); - return ( function[ neighbourEntities.template getEntityIndex< 0, 1, 0 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 0, 1, 0 >( cellIndex ) ] - 2.0 * function[ cellIndex ] + - function[ neighbourEntities.template getEntityIndex< 0, -1, 0 >( cellIndex ) ] ) / ( hy * hy ); + function[ neighborEntities.template getEntityIndex< 0, -1, 0 >( cellIndex ) ] ) / ( hy * hy ); } if( ZDifferenceOrder == 1 ) { const RealType hz = grid.getSpaceSteps().z(); - return ( function[ neighbourEntities.template getEntityIndex< 0, 0, ZDifferenceDirection >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 0, 0, ZDifferenceDirection >( cellIndex ) ] - function[ cellIndex ] ) / ( ZDifferenceDirection * hz ); } if( ZDifferenceOrder == 2 ) { const RealType hz = grid.getSpaceSteps().z(); - return ( function[ neighbourEntities.template getEntityIndex< 0, 0, 1 >( cellIndex ) ] - + return ( function[ neighborEntities.template getEntityIndex< 0, 0, 1 >( cellIndex ) ] - 2.0 * function[ cellIndex ] + - function[ neighbourEntities.template getEntityIndex< 0, 0, -1 >( cellIndex ) ] ) / ( hz * hz ); + function[ neighborEntities.template getEntityIndex< 0, 0, -1 >( cellIndex ) ] ) / ( hz * hz ); } diff --git a/src/TNL/Operators/FunctionInverseOperator.h b/src/TNL/Operators/FunctionInverseOperator.h index 1a849f9ed2de751d16000dfc6d1e41b357755f9c..f202d870cf79e1888fc3a9daf7701b94bfb928c8 100644 --- a/src/TNL/Operators/FunctionInverseOperator.h +++ b/src/TNL/Operators/FunctionInverseOperator.h @@ -21,8 +21,8 @@ template< typename OperatorT > class FunctionInverseOperator : public Operator< typename OperatorT::MeshType, OperatorT::getDomainType(), - OperatorT::getPreimageEntitiesDimensions(), - OperatorT::getImageEntitiesDimensions(), + OperatorT::getPreimageEntitiesDimension(), + OperatorT::getImageEntitiesDimension(), typename OperatorT::RealType, typename OperatorT::IndexType > { diff --git a/src/TNL/Operators/IdentityOperator.h b/src/TNL/Operators/IdentityOperator.h index afe0e3d2a314fb02dde40990a188c461f207b7c3..f48fbc8347887b8d923ff36622acde08d47d6d98 100644 --- a/src/TNL/Operators/IdentityOperator.h +++ b/src/TNL/Operators/IdentityOperator.h @@ -17,7 +17,7 @@ namespace Operators { template< typename MeshFunction > class IdentityOperator - : public Domain< MeshFunction::getDimensions(), MeshFunction::getDomainType() > + : public Domain< MeshFunction::getMeshDimension(), MeshFunction::getDomainType() > { public: @@ -35,7 +35,7 @@ class IdentityOperator const MeshEntity& meshEntity, const RealType& time = 0 ) const { - static_assert( MeshFunction::getDimensions() == InnerOperator::getDimensions(), + static_assert( MeshFunction::getMeshDimension() == InnerOperator::getDimension(), "Mesh function and operator have both different number of dimensions." ); return this->meshFunction( meshEntity, time ); } diff --git a/src/TNL/Operators/NeumannBoundaryConditions.h b/src/TNL/Operators/NeumannBoundaryConditions.h index 1461135eebaa135043e1f60452a178f2633b4737..91f09fd0ea6ce08651bb392655244d56db0f16b1 100644 --- a/src/TNL/Operators/NeumannBoundaryConditions.h +++ b/src/TNL/Operators/NeumannBoundaryConditions.h @@ -96,7 +96,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, typedef Function FunctionType; typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType; - typedef Containers::StaticVector< 1, RealType > VertexType; + typedef Containers::StaticVector< 1, RealType > PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef NeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType; typedef NeumannBoundaryConditionsBase< Function > BaseType; @@ -109,13 +109,13 @@ class NeumannBoundaryConditions< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, const RealType& time = 0 ) const { const MeshType& mesh = entity.getMesh(); - const auto& neighbourEntities = entity.getNeighbourEntities(); + const auto& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); if( entity.getCoordinates().x() == 0 ) - return u[ neighbourEntities.template getEntityIndex< 1 >() ] - entity.getMesh().getSpaceSteps().x() * + return u[ neighborEntities.template getEntityIndex< 1 >() ] - entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); else - return u[ neighbourEntities.template getEntityIndex< -1 >() ] + entity.getMesh().getSpaceSteps().x() * + return u[ neighborEntities.template getEntityIndex< -1 >() ] + entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } @@ -142,19 +142,19 @@ class NeumannBoundaryConditions< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Matrix& matrix, Vector& b ) const { - const auto& neighbourEntities = entity.getNeighbourEntities(); + const auto& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); if( entity.getCoordinates().x() == 0 ) { matrixRow.setElement( 0, index, 1.0 ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1 >(), -1.0 ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 1 >(), -1.0 ); b[ index ] = - entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } else { - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1 >(), -1.0 ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< -1 >(), -1.0 ); matrixRow.setElement( 1, index, 1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); @@ -189,7 +189,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, typedef Function FunctionType; typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType; - typedef Containers::StaticVector< 2, RealType > VertexType; + typedef Containers::StaticVector< 2, RealType > PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef NeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType; typedef NeumannBoundaryConditionsBase< Function > BaseType; @@ -203,27 +203,27 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, const RealType& time = 0 ) const { const MeshType& mesh = entity.getMesh(); - const auto& neighbourEntities = entity.getNeighbourEntities(); + const auto& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); if( entity.getCoordinates().x() == 0 ) { - return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] - entity.getMesh().getSpaceSteps().x() * + return u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { - return u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] + entity.getMesh().getSpaceSteps().x() * + return u[ neighborEntities.template getEntityIndex< -1, 0 >() ] + entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == 0 ) { - return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - entity.getMesh().getSpaceSteps().y() * + return u[ neighborEntities.template getEntityIndex< 0, 1 >() ] - entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } // The following line is commented to avoid compiler warning //if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) { - return u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] + entity.getMesh().getSpaceSteps().y() * + return u[ neighborEntities.template getEntityIndex< 0, -1 >() ] + entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } } @@ -249,19 +249,19 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Matrix& matrix, Vector& b ) const { - const auto& neighbourEntities = entity.getNeighbourEntities(); + const auto& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); if( entity.getCoordinates().x() == 0 ) { matrixRow.setElement( 0, index, 1.0 ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1, 0 >(), -1.0 ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 1, 0 >(), -1.0 ); b[ index ] = - entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1, 0 >(), -1.0 ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< -1, 0 >(), -1.0 ); matrixRow.setElement( 1, index, 1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); @@ -269,13 +269,13 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().y() == 0 ) { matrixRow.setElement( 0, index, 1.0 ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 1 >(), -1.0 ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 0, 1 >(), -1.0 ); b[ index ] = - entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) { - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, -1 >(), -1.0 ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< 0, -1 >(), -1.0 ); matrixRow.setElement( 1, index, 1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); @@ -309,7 +309,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, typedef Function FunctionType; typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType; - typedef Containers::StaticVector< 3, RealType > VertexType; + typedef Containers::StaticVector< 3, RealType > PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef NeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType; typedef NeumannBoundaryConditionsBase< Function > BaseType; @@ -322,37 +322,37 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, const RealType& time = 0 ) const { const MeshType& mesh = entity.getMesh(); - const auto& neighbourEntities = entity.getNeighbourEntities(); + const auto& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); if( entity.getCoordinates().x() == 0 ) { - return u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] - entity.getMesh().getSpaceSteps().x() * + return u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { - return u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] + entity.getMesh().getSpaceSteps().x() * + return u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] + entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == 0 ) { - return u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - entity.getMesh().getSpaceSteps().y() * + return u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) { - return u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] + entity.getMesh().getSpaceSteps().y() * + return u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] + entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().z() == 0 ) { - return u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - entity.getMesh().getSpaceSteps().z() * + return u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - entity.getMesh().getSpaceSteps().z() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } // The following line is commented to avoid compiler warning //if( entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 ) { - return u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] + entity.getMesh().getSpaceSteps().z() * + return u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] + entity.getMesh().getSpaceSteps().z() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } } @@ -379,19 +379,19 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Matrix& matrix, Vector& b ) const { - const auto& neighbourEntities = entity.getNeighbourEntities(); + const auto& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); if( entity.getCoordinates().x() == 0 ) { matrixRow.setElement( 0, index, 1.0 ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1, 0, 0 >(), -1.0 ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 1, 0, 0 >(), -1.0 ); b[ index ] = - entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1, 0, 0 >(), -1.0 ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< -1, 0, 0 >(), -1.0 ); matrixRow.setElement( 1, index, 1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); @@ -399,13 +399,13 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().y() == 0 ) { matrixRow.setElement( 0, index, 1.0 ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 1, 0 >(), -1.0 ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 0, 1, 0 >(), -1.0 ); b[ index ] = - entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) { - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, -1, 0 >(), -1.0 ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< 0, -1, 0 >(), -1.0 ); matrixRow.setElement( 1, index, 1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().y() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); @@ -413,13 +413,13 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().z() == 0 ) { matrixRow.setElement( 0, index, 1.0 ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 0, 1 >(), -1.0 ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 0, 0, 1 >(), -1.0 ); b[ index ] = - entity.getMesh().getSpaceSteps().z() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 ) { - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, 0, -1 >(), -1.0 ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< 0, 0, -1 >(), -1.0 ); matrixRow.setElement( 1, index, 1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().z() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); diff --git a/src/TNL/Operators/Operator.h b/src/TNL/Operators/Operator.h index f0cf536e1eacb460ac3144719408a769d7d19989..b18e31fc4fbc0b453840733871afdbcd360afc8f 100644 --- a/src/TNL/Operators/Operator.h +++ b/src/TNL/Operators/Operator.h @@ -17,11 +17,11 @@ namespace Operators { template< typename Mesh, Functions::DomainType DomainType = Functions::MeshInteriorDomain, - int PreimageEntitiesDimensions = Mesh::getMeshDimensions(), - int ImageEntitiesDimensions = Mesh::getMeshDimensions(), + int PreimageEntitiesDimension = Mesh::getMeshDimension(), + int ImageEntitiesDimension = Mesh::getMeshDimension(), typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > -class Operator : public Functions::Domain< Mesh::getMeshDimensions(), DomainType > +class Operator : public Functions::Domain< Mesh::getMeshDimension(), DomainType > { public: @@ -33,9 +33,9 @@ class Operator : public Functions::Domain< Mesh::getMeshDimensions(), DomainType typedef Index IndexType; typedef void ExactOperatorType; - constexpr static int getMeshDimensions() { return MeshType::getMeshDimensions(); } - constexpr static int getPreimageEntitiesDimensions() { return PreimageEntitiesDimensions; } - constexpr static int getImageEntitiesDimensions() { return ImageEntitiesDimensions; } + constexpr static int getDimension() { return MeshType::getMeshDimension(); } + constexpr static int getPreimageEntitiesDimension() { return PreimageEntitiesDimension; } + constexpr static int getImageEntitiesDimension() { return ImageEntitiesDimension; } bool refresh( const RealType& time = 0.0 ) { return true; } diff --git a/src/TNL/Operators/OperatorComposition.h b/src/TNL/Operators/OperatorComposition.h index c935a3741607e025808c7664f07fb1077284602a..e4730c2429c9f98b6f331bd7564fc78c226708d8 100644 --- a/src/TNL/Operators/OperatorComposition.h +++ b/src/TNL/Operators/OperatorComposition.h @@ -32,8 +32,8 @@ template< typename OuterOperator, class OperatorComposition : public Operator< typename InnerOperator::MeshType, InnerOperator::getDomainType(), - InnerOperator::getPreimageEntitiesDimensions(), - OuterOperator::getImageEntitiesDimensions(), + InnerOperator::getPreimageEntitiesDimension(), + OuterOperator::getImageEntitiesDimension(), typename InnerOperator::RealType, typename OuterOperator::IndexType > { @@ -42,8 +42,8 @@ class OperatorComposition public: typedef typename InnerOperator::MeshType MeshType; - typedef Functions::MeshFunction< MeshType, InnerOperator::getPreimageEntitiesDimensions() > PreimageFunctionType; - typedef Functions::MeshFunction< MeshType, InnerOperator::getImageEntitiesDimensions() > ImageFunctionType; + typedef Functions::MeshFunction< MeshType, InnerOperator::getPreimageEntitiesDimension() > PreimageFunctionType; + typedef Functions::MeshFunction< MeshType, InnerOperator::getImageEntitiesDimension() > ImageFunctionType; typedef Functions::OperatorFunction< InnerOperator, PreimageFunctionType, InnerBoundaryConditions > InnerOperatorFunction; typedef Functions::OperatorFunction< InnerOperator, ImageFunctionType > OuterOperatorFunction; typedef typename InnerOperator::RealType RealType; @@ -52,8 +52,8 @@ class OperatorComposition typename InnerOperator::ExactOperatorType > ExactOperatorType; typedef SharedPointer< MeshType > MeshPointer; - static constexpr int getPreimageEntitiesDimensions() { return InnerOperator::getImageEntitiesDimensions(); }; - static constexpr int getImageEntitiesDimensions() { return OuterOperator::getImageEntitiesDimensions(); }; + static constexpr int getPreimageEntitiesDimension() { return InnerOperator::getImageEntitiesDimension(); }; + static constexpr int getImageEntitiesDimension() { return OuterOperator::getImageEntitiesDimension(); }; OperatorComposition( OuterOperator& outerOperator, InnerOperator& innerOperator, @@ -102,7 +102,7 @@ class OperatorComposition const MeshEntity& meshEntity, const RealType& time = 0.0 ) const { - static_assert( MeshFunction::getDimensions() == InnerOperator::getDimensions(), + static_assert( MeshFunction::getMeshDimension() == InnerOperator::getDimension(), "Mesh function and operator have both different number of dimensions." ); //InnerOperatorFunction innerOperatorFunction( innerOperator, function ); return outerOperator( innerOperatorFunction, meshEntity, time ); @@ -118,15 +118,15 @@ class OperatorComposition template< typename OuterOperator, typename InnerOperator > class OperatorComposition< OuterOperator, InnerOperator, void > - : public Functions::Domain< InnerOperator::getDimensions(), InnerOperator::getDomainType() > + : public Functions::Domain< InnerOperator::getDimension(), InnerOperator::getDomainType() > { static_assert( std::is_same< typename OuterOperator::MeshType, typename InnerOperator::MeshType >::value, "Both operators have different mesh types." ); public: typedef typename InnerOperator::MeshType MeshType; - typedef Functions::MeshFunction< MeshType, InnerOperator::getPreimageEntitiesDimensions() > PreimageFunctionType; - typedef Functions::MeshFunction< MeshType, InnerOperator::getImageEntitiesDimensions() > ImageFunctionType; + typedef Functions::MeshFunction< MeshType, InnerOperator::getPreimageEntitiesDimension() > PreimageFunctionType; + typedef Functions::MeshFunction< MeshType, InnerOperator::getImageEntitiesDimension() > ImageFunctionType; typedef Functions::OperatorFunction< InnerOperator, PreimageFunctionType, void > InnerOperatorFunction; typedef Functions::OperatorFunction< InnerOperator, ImageFunctionType > OuterOperatorFunction; typedef typename InnerOperator::RealType RealType; @@ -157,7 +157,7 @@ class OperatorComposition< OuterOperator, InnerOperator, void > bool refresh( const RealType& time = 0.0 ) { return this->innerOperatorFunction.refresh( time ); - /*MeshFunction< MeshType, MeshType::getMeshDimensions() - 1 > f( this->innerOperatorFunction.getMesh() ); + /*MeshFunction< MeshType, MeshType::getMeshDimension() - 1 > f( this->innerOperatorFunction.getMesh() ); f = this->innerOperatorFunction; this->innerOperatorFunction.getPreimageFunction().write( "preimageFunction", "gnuplot" ); f.write( "innerFunction", "gnuplot" ); @@ -178,7 +178,7 @@ class OperatorComposition< OuterOperator, InnerOperator, void > const MeshEntity& meshEntity, const RealType& time = 0.0 ) const { - static_assert( MeshFunction::getDimensions() == InnerOperator::getDimensions(), + static_assert( MeshFunction::getMeshDimension() == InnerOperator::getDimension(), "Mesh function and operator have both different number of dimensions." ); //InnerOperatorFunction innerOperatorFunction( innerOperator, function ); return outerOperator( innerOperatorFunction, meshEntity, time ); diff --git a/src/TNL/Operators/diffusion/ExactLinearDiffusion.h b/src/TNL/Operators/diffusion/ExactLinearDiffusion.h index 46a88172fdb74673e291fe14394ea0367ac2fb25..790fa0777996839904b2c8270720dde20afc8946 100644 --- a/src/TNL/Operators/diffusion/ExactLinearDiffusion.h +++ b/src/TNL/Operators/diffusion/ExactLinearDiffusion.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Functions/Domain.h> @@ -15,7 +21,7 @@ namespace TNL { namespace Operators { -template< int Dimensions > +template< int Dimension > class ExactLinearDiffusion {}; @@ -24,14 +30,14 @@ class ExactLinearDiffusion< 1 > : public Functions::Domain< 1, Functions::SpaceD { public: - static const int Dimensions = 1; + static const int Dimension = 1; static String getType(); template< typename Function > __cuda_callable__ inline typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const; }; @@ -40,14 +46,14 @@ class ExactLinearDiffusion< 2 > : public Functions::Domain< 2, Functions::SpaceD { public: - static const int Dimensions = 2; + static const int Dimension = 2; static String getType(); template< typename Function > __cuda_callable__ inline typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const; }; @@ -56,14 +62,14 @@ class ExactLinearDiffusion< 3 > : public Functions::Domain< 3 > { public: - static const int Dimensions = 3; + static const int Dimension = 3; static String getType(); template< typename Function > __cuda_callable__ inline typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const; }; diff --git a/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h b/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h index 3e85c193b2071372f79c9f7ed283d872a41a0b7c..0aabb1027e38d3390ca009813e7ac1bf54cb006d 100644 --- a/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h +++ b/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once namespace TNL { @@ -25,7 +31,7 @@ __cuda_callable__ inline typename Function::RealType ExactLinearDiffusion< 1 >:: operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time ) const { return function.template getPartialDerivative< 2, 0, 0 >( v, time ); @@ -43,7 +49,7 @@ __cuda_callable__ inline typename Function::RealType ExactLinearDiffusion< 2 >:: operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time ) const { return function.template getPartialDerivative< 2, 0, 0 >( v, time ) + @@ -62,7 +68,7 @@ __cuda_callable__ inline typename Function::RealType ExactLinearDiffusion< 3 >:: operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time ) const { return function.template getPartialDerivative< 2, 0, 0 >( v, time ) + diff --git a/src/TNL/Operators/diffusion/ExactMeanCurvature.h b/src/TNL/Operators/diffusion/ExactMeanCurvature.h index 04ac9df5d0642fdb9a6681b576099f7d8e6dd439..fbc2260efad49c99337d7af994bc3c61ef89c90e 100644 --- a/src/TNL/Operators/diffusion/ExactMeanCurvature.h +++ b/src/TNL/Operators/diffusion/ExactMeanCurvature.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Operators/diffusion/ExactNonlinearDiffusion.h> @@ -17,21 +23,21 @@ namespace TNL { namespace Operators { -template< int Dimensions, - typename InnerOperator = ExactIdentityOperator< Dimensions > > +template< int Dimension, + typename InnerOperator = ExactIdentityOperator< Dimension > > class ExactMeanCurvature -: public Functions::Domain< Dimensions, Functions::SpaceDomain > +: public Functions::Domain< Dimension, Functions::SpaceDomain > { public: - typedef ExactGradientNorm< Dimensions > ExactGradientNormType; - typedef ExactFunctionInverseOperator< Dimensions, ExactGradientNormType > FunctionInverse; - typedef ExactNonlinearDiffusion< Dimensions, FunctionInverse > NonlinearDiffusion; + typedef ExactGradientNorm< Dimension > ExactGradientNormType; + typedef ExactFunctionInverseOperator< Dimension, ExactGradientNormType > FunctionInverse; + typedef ExactNonlinearDiffusion< Dimension, FunctionInverse > NonlinearDiffusion; static String getType() { return String( "ExactMeanCurvature< " ) + - String( Dimensions) + ", " + + String( Dimension) + ", " + InnerOperator::getType() + " >"; } @@ -45,7 +51,7 @@ class ExactMeanCurvature __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { return this->nonlinearDiffusion( function, v, time ); @@ -58,7 +64,7 @@ class ExactMeanCurvature __cuda_callable__ typename Function::RealType getPartialDerivative( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0, diff --git a/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h b/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h index d1fc5e574ce2fbcd7f5e856d66c7bbc0a11b9c9f..25381e2bb48bcdbdbde8f419c1cac856f621d7fd 100644 --- a/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h +++ b/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Functions/Domain.h> @@ -17,9 +23,9 @@ namespace TNL { namespace Operators { -template< int Dimensions, +template< int Dimension, typename Nonlinearity, - typename InnerOperator = ExactIdentityOperator< Dimensions > > + typename InnerOperator = ExactIdentityOperator< Dimension > > class ExactNonlinearDiffusion {}; @@ -60,7 +66,7 @@ class ExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator > __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { typedef typename Function::RealType RealType; @@ -114,7 +120,7 @@ class ExactNonlinearDiffusion< 2, Nonlinearity, InnerOperator > __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { typedef typename Function::RealType RealType; @@ -173,7 +179,7 @@ class ExactNonlinearDiffusion< 3, Nonlinearity, InnerOperator > __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { typedef typename Function::RealType RealType; diff --git a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h index 6daa0a2de9e8c33622c9525af9c13ffc52d38b54..93e5d48e95acc6b9a66378d1f449791925900ec0 100644 --- a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h +++ b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h @@ -7,6 +7,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Containers/Vector.h> diff --git a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h index dc223e6bcbb5399cd7c660c00f5891d1da6a8d34..083160467875cc0e4f40b15c63b7cf59c222a68b 100644 --- a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h +++ b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h @@ -7,6 +7,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include "FiniteVolumeNonlinearOperator.h" @@ -124,14 +130,14 @@ operator()( const MeshEntity& entity, const Vector& u, const Real& time ) const { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const IndexType& cellIndex = entity.getIndex(); return operatorQ( entity, u, time ) * - ( ( u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -2, 0 >() / operatorQ.operator()( entity, u, time, 1 ) - + ( u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 1 ) - - ( -u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] + u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -2, 0 >() / operatorQ.operator()( entity, u, time, -1) - - ( -u[ neighbourEntities.template getEntityIndex< 0,-1 >() ] + u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, -1) ); + ( ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -2, 0 >() / operatorQ.operator()( entity, u, time, 1 ) + + ( u[ neighborEntities.template getEntityIndex< 0, 1 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 1 ) + - ( -u[ neighborEntities.template getEntityIndex< -1, 0 >() ] + u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -2, 0 >() / operatorQ.operator()( entity, u, time, -1) + - ( -u[ neighborEntities.template getEntityIndex< 0,-1 >() ] + u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, -1) ); } template< typename MeshReal, @@ -174,7 +180,7 @@ setMatrixElements( const RealType& time, Matrix& matrix ) const { typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType aCoef = - tau * operatorQ.operator()( entity, u, time ) * mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, -1 ); const RealType bCoef = - tau * operatorQ.operator()( entity, u, time ) * mesh.template getSpaceStepsProducts< -2, 0 >() / @@ -188,11 +194,11 @@ setMatrixElements( const RealType& time, operatorQ.operator()( entity, u, time, 1 ); const RealType eCoef = - tau * operatorQ.operator()( entity, u, time ) * mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 1 ); - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, -1 >(), aCoef ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< -1, 0 >(), bCoef ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< 0, -1 >(), aCoef ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< -1, 0 >(), bCoef ); matrixRow.setElement( 2, entity.getIndex(), cCoef ); - matrixRow.setElement( 3, neighbourEntities.template getEntityIndex< 1, 0 >(), dCoef ); - matrixRow.setElement( 4, neighbourEntities.template getEntityIndex< 0, 1 >(), eCoef ); + matrixRow.setElement( 3, neighborEntities.template getEntityIndex< 1, 0 >(), dCoef ); + matrixRow.setElement( 4, neighborEntities.template getEntityIndex< 0, 1 >(), eCoef ); } template< typename MeshReal, @@ -227,21 +233,21 @@ operator()( const MeshEntity& entity, const Vector& u, const Real& time ) const { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const IndexType& cellIndex = entity.getIndex(); return operatorQ( entity, u, time ) * - ( (u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ]) + ( (u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ]) * mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ( entity, u, time, 1 ) - + ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, -2, 0 >()/ + + ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, -2, 0 >()/ operatorQ( entity, u, time, 0, 1 ) - + ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, 0, -2 >()/ + + ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, 0, -2 >()/ operatorQ( entity, u, time, 0, 0, 1 ) - - ( - u[ neighbourEntities.template getEntityIndex< -1,0,0 >() ] + u[ cellIndex ]) + - ( - u[ neighborEntities.template getEntityIndex< -1,0,0 >() ] + u[ cellIndex ]) * mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ( entity, u, time, -1) - -( - u[ neighbourEntities.template getEntityIndex< 0,-1,0 >() ] + u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, -2, 0 >() + -( - u[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] + u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, -2, 0 >() /operatorQ( entity, u, time, 0, -1) - -( - u[ neighbourEntities.template getEntityIndex< 0,0,-1 >() ] + u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, 0, -2 >() + -( - u[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] + u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, 0, -2 >() /operatorQ( entity, u, time, 0, 0, -1) ); } @@ -287,7 +293,7 @@ setMatrixElements( const RealType& time, Matrix& matrix ) const { typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType aCoef = - tau * operatorQ( entity, u, time ) * mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 0, -1 ); const RealType bCoef = - tau * operatorQ( entity, u, time ) * @@ -307,13 +313,13 @@ setMatrixElements( const RealType& time, mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ.operator()( entity, u, time, 0, 1, 0 ); const RealType gCoef = - tau * operatorQ.operator()( entity, u, time ) * mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 0, 1 ); - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0,0,-1 >(), aCoef ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0,-1,0 >(), bCoef ); - matrixRow.setElement( 2, neighbourEntities.template getEntityIndex< -1,0,0 >(), cCoef ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< 0,0,-1 >(), aCoef ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 0,-1,0 >(), bCoef ); + matrixRow.setElement( 2, neighborEntities.template getEntityIndex< -1,0,0 >(), cCoef ); matrixRow.setElement( 3, entity.getIndex(), dCoef ); - matrixRow.setElement( 4, neighbourEntities.template getEntityIndex< 1,0,0 >(), eCoef ); - matrixRow.setElement( 5, neighbourEntities.template getEntityIndex< 0,1,0 >(), fCoef ); - matrixRow.setElement( 6, neighbourEntities.template getEntityIndex< 0,0,1 >(), gCoef ); + matrixRow.setElement( 4, neighborEntities.template getEntityIndex< 1,0,0 >(), eCoef ); + matrixRow.setElement( 5, neighborEntities.template getEntityIndex< 0,1,0 >(), fCoef ); + matrixRow.setElement( 6, neighborEntities.template getEntityIndex< 0,0,1 >(), gCoef ); } } // namespace Operators diff --git a/src/TNL/Operators/diffusion/LinearDiffusion.h b/src/TNL/Operators/diffusion/LinearDiffusion.h index dd38c170daa48b4473c6e08a7a8e775fdc89578d..8844e547ad9f8b9f53f12b47eddb08caf8d30f7c 100644 --- a/src/TNL/Operators/diffusion/LinearDiffusion.h +++ b/src/TNL/Operators/diffusion/LinearDiffusion.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Containers/Vector.h> @@ -46,9 +52,9 @@ class LinearDiffusion< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Inde typedef Index IndexType; typedef ExactLinearDiffusion< 1 > ExactOperatorType; - static const int Dimensions = MeshType::meshDimensions; + static const int Dimension = MeshType::meshDimension; - static constexpr int getMeshDimensions() { return Dimensions; } + static constexpr int getDimension() { return Dimension; } static String getType(); @@ -97,9 +103,9 @@ class LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Ind typedef Index IndexType; typedef ExactLinearDiffusion< 2 > ExactOperatorType; - static const int Dimensions = MeshType::meshDimensions; + static const int Dimension = MeshType::meshDimension; - static constexpr int getMeshDimensions() { return Dimensions; } + static constexpr int getDimension() { return Dimension; } static String getType(); @@ -147,9 +153,9 @@ class LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Ind typedef Index IndexType; typedef ExactLinearDiffusion< 3 > ExactOperatorType; - static const int Dimensions = MeshType::meshDimensions; + static const int Dimension = MeshType::meshDimension; - static constexpr int getMeshDimensions() { return Dimensions; } + static constexpr int getDimension() { return Dimension; } static String getType(); diff --git a/src/TNL/Operators/diffusion/LinearDiffusion_impl.h b/src/TNL/Operators/diffusion/LinearDiffusion_impl.h index c20e8fa39ffe917ab69511a63894b50f13aac744..6edc08d85fb2152b9735ba04b98152943e4a516a 100644 --- a/src/TNL/Operators/diffusion/LinearDiffusion_impl.h +++ b/src/TNL/Operators/diffusion/LinearDiffusion_impl.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Operators/diffusion/LinearDiffusion.h> @@ -46,13 +52,13 @@ operator()( const PreimageFunction& u, const MeshEntity& entity, const Real& time ) const { - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( PreimageFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( PreimageFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< - 2 >(); - return ( u[ neighbourEntities.template getEntityIndex< -1 >() ] + return ( u[ neighborEntities.template getEntityIndex< -1 >() ] - 2.0 * u[ entity.getIndex() ] - + u[ neighbourEntities.template getEntityIndex< 1 >() ] ) * hxSquareInverse; + + u[ neighborEntities.template getEntityIndex< 1 >() ] ) * hxSquareInverse; } template< typename MeshReal, @@ -92,15 +98,15 @@ setMatrixElements( const PreimageFunction& u, Matrix& matrix, Vector& b ) const { - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( PreimageFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( PreimageFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); const RealType lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< -1 >(), - lambdaX ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< -1 >(), - lambdaX ); matrixRow.setElement( 1, index, 2.0 * lambdaX ); - matrixRow.setElement( 2, neighbourEntities.template getEntityIndex< 1 >(), - lambdaX ); + matrixRow.setElement( 2, neighborEntities.template getEntityIndex< 1 >(), - lambdaX ); } template< typename MeshReal, @@ -151,15 +157,15 @@ operator()( const PreimageFunction& u, const EntityType& entity, const Real& time ) const { - static_assert( EntityType::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( PreimageFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename EntityType::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( EntityType::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( PreimageFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename EntityType::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); - return ( u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] - + u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] ) * hxSquareInverse + - ( u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] - + u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] ) * hySquareInverse + return ( u[ neighborEntities.template getEntityIndex< -1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0 >() ] ) * hxSquareInverse + + ( u[ neighborEntities.template getEntityIndex< 0, -1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1 >() ] ) * hySquareInverse - 2.0 * u[ entity.getIndex() ] * ( hxSquareInverse + hySquareInverse ); } @@ -183,18 +189,18 @@ setMatrixElements( const PreimageFunction& u, Matrix& matrix, Vector& b ) const { - static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( PreimageFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); + static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( PreimageFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); const IndexType& index = entity.getIndex(); typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); const RealType lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, -1 >(), -lambdaY ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< -1, 0 >(), -lambdaX ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< 0, -1 >(), -lambdaY ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< -1, 0 >(), -lambdaX ); matrixRow.setElement( 2, index, 2.0 * ( lambdaX + lambdaY ) ); - matrixRow.setElement( 3, neighbourEntities.template getEntityIndex< 1, 0 >(), -lambdaX ); - matrixRow.setElement( 4, neighbourEntities.template getEntityIndex< 0, 1 >(), -lambdaY ); + matrixRow.setElement( 3, neighborEntities.template getEntityIndex< 1, 0 >(), -lambdaX ); + matrixRow.setElement( 4, neighborEntities.template getEntityIndex< 0, 1 >(), -lambdaY ); } @@ -228,18 +234,18 @@ operator()( const PreimageFunction& u, const EntityType& entity, const Real& time ) const { - static_assert( EntityType::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( PreimageFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename EntityType::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( EntityType::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( PreimageFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename EntityType::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); - return ( u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] - + u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] ) * hxSquareInverse + - ( u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] - + u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] ) * hySquareInverse + - ( u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] - + u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] ) * hzSquareInverse + return ( u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] ) * hxSquareInverse + + ( u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] ) * hySquareInverse + + ( u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] ) * hzSquareInverse - 2.0 * u[ entity.getIndex() ] * ( hxSquareInverse + hySquareInverse + hzSquareInverse ); } @@ -280,21 +286,21 @@ setMatrixElements( const PreimageFunction& u, Matrix& matrix, Vector& b ) const { - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( PreimageFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( PreimageFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); const RealType lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); - matrixRow.setElement( 0, neighbourEntities.template getEntityIndex< 0, 0, -1 >(), -lambdaZ ); - matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, -1, 0 >(), -lambdaY ); - matrixRow.setElement( 2, neighbourEntities.template getEntityIndex< -1, 0, 0 >(), -lambdaX ); + matrixRow.setElement( 0, neighborEntities.template getEntityIndex< 0, 0, -1 >(), -lambdaZ ); + matrixRow.setElement( 1, neighborEntities.template getEntityIndex< 0, -1, 0 >(), -lambdaY ); + matrixRow.setElement( 2, neighborEntities.template getEntityIndex< -1, 0, 0 >(), -lambdaX ); matrixRow.setElement( 3, index, 2.0 * ( lambdaX + lambdaY + lambdaZ ) ); - matrixRow.setElement( 4, neighbourEntities.template getEntityIndex< 1, 0, 0 >(), -lambdaX ); - matrixRow.setElement( 5, neighbourEntities.template getEntityIndex< 0, 1, 0 >(), -lambdaY ); - matrixRow.setElement( 6, neighbourEntities.template getEntityIndex< 0, 0, 1 >(), -lambdaZ ); + matrixRow.setElement( 4, neighborEntities.template getEntityIndex< 1, 0, 0 >(), -lambdaX ); + matrixRow.setElement( 5, neighborEntities.template getEntityIndex< 0, 1, 0 >(), -lambdaY ); + matrixRow.setElement( 6, neighborEntities.template getEntityIndex< 0, 0, 1 >(), -lambdaZ ); } } // namespace Operators diff --git a/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h b/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h index da4b1d281f43fbe6bdc18fe4712a13036bbaa3bd..0dbc269883acadf563cf6fa6f5c28c185e24436f 100644 --- a/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h +++ b/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h @@ -1,9 +1,25 @@ +/*************************************************************************** + NonlinearDiffusion.h - description + ------------------- + begin : Aug 8, 2014 + copyright : (C) 2014 by Tomas Oberhuber + email : tomas.oberhuber@fjfi.cvut.cz + ***************************************************************************/ + +/* See Copyright Notice in tnl/Copyright */ #pragma once #include "NonlinearDiffusion.h" #include <TNL/Meshes/Grid.h> +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + + namespace TNL { namespace Operators { diff --git a/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h b/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h index f6d2871c199d4c147173171bbb25260fc8f03225..5e3e4d59c2aa98d09d8cbee72a105bf2dcfb37c6 100644 --- a/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h +++ b/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Operators/Operator.h> @@ -27,7 +33,7 @@ template< typename Mesh, typename Index = typename Mesh::IndexType, bool EvaluateNonlinearityOnFly = false > class OneSidedMeanCurvature - : public Operator< Mesh, Functions::MeshInteriorDomain, Mesh::getMeshDimensions(), Mesh::getMeshDimensions(), Real, Index > + : public Operator< Mesh, Functions::MeshInteriorDomain, Mesh::getMeshDimension(), Mesh::getMeshDimension(), Real, Index > { public: @@ -37,12 +43,12 @@ class OneSidedMeanCurvature typedef Index IndexType; typedef FDMGradientNorm< MeshType, ForwardFiniteDifference, RealType, IndexType > GradientNorm; typedef FunctionInverseOperator< GradientNorm > NonlinearityOperator; - typedef Functions::MeshFunction< MeshType, MeshType::getMeshDimensions(), RealType > NonlinearityMeshFunction; - typedef Functions::Analytic::Constant< MeshType::getMeshDimensions(), RealType > NonlinearityBoundaryConditionsFunction; + typedef Functions::MeshFunction< MeshType, MeshType::getMeshDimension(), RealType > NonlinearityMeshFunction; + typedef Functions::Analytic::Constant< MeshType::getMeshDimension(), RealType > NonlinearityBoundaryConditionsFunction; typedef NeumannBoundaryConditions< MeshType, NonlinearityBoundaryConditionsFunction > NonlinearityBoundaryConditions; typedef Functions::OperatorFunction< NonlinearityOperator, NonlinearityMeshFunction, NonlinearityBoundaryConditions, EvaluateNonlinearityOnFly > Nonlinearity; typedef OneSidedNonlinearDiffusion< Mesh, Nonlinearity, RealType, IndexType > NonlinearDiffusion; - typedef ExactMeanCurvature< Mesh::getMeshDimensions(), RealType > ExactOperatorType; + typedef ExactMeanCurvature< Mesh::getMeshDimension(), RealType > ExactOperatorType; OneSidedMeanCurvature( const MeshPointer& meshPointer ) : nonlinearityOperator( gradientNorm ), diff --git a/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h b/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h index 652bf8ba1801f0ea17f0c0881bbe277d08e1f546..9f6e72aa5ea303fe121f447cb2e8d081c32ec497 100644 --- a/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h +++ b/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h @@ -8,6 +8,11 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ #pragma once @@ -42,8 +47,8 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, typedef Device DeviceType; typedef Index IndexType; typedef Nonlinearity NonlinearityType; - typedef typename MeshType::template MeshEntity< MeshType::getMeshDimensions() > CellType; - typedef ExactNonlinearDiffusion< MeshType::getMeshDimensions(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType; + typedef typename MeshType::template MeshEntity< MeshType::getMeshDimension() > CellType; + typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType; OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity ) : nonlinearity( nonlinearity ){} @@ -64,12 +69,12 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, const MeshEntity& entity, const RealType& time = 0.0 ) const { - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& hx_div = entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); const RealType& u_c = u[ center ]; const RealType u_x_f = ( u[ east ] - u_c ); const RealType u_x_b = ( u_c - u[ west ] ); @@ -100,10 +105,10 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Vector& b ) const { typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); const RealType lambda_x = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const RealType& nonlinearity_center = this->nonlinearity[ center ]; const RealType& nonlinearity_west = this->nonlinearity[ west ]; @@ -137,7 +142,7 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex > typedef Device DeviceType; typedef Index IndexType; typedef Nonlinearity NonlinearityType; - typedef ExactNonlinearDiffusion< MeshType::getMeshDimensions(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType; + typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType; OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity ) : nonlinearity( nonlinearity ){} @@ -158,15 +163,15 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex > const MeshEntity& entity, const RealType& time = 0.0 ) const { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& hx_div = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& hy_div = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); const RealType& u_c = u[ center ]; const RealType u_x_f = ( u[ east ] - u_c ); const RealType u_x_b = ( u_c - u[ west ] ); @@ -200,12 +205,12 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex > Vector& b ) const { typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); const RealType lambda_x = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType lambda_y = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const RealType& nonlinearity_center = this->nonlinearity[ center ]; @@ -246,7 +251,7 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex > typedef Device DeviceType; typedef Index IndexType; typedef Nonlinearity NonlinearityType; - typedef ExactNonlinearDiffusion< MeshType::getMeshDimensions(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType; + typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType; OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity ) : nonlinearity( nonlinearity ){} @@ -267,18 +272,18 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex > const MeshEntity& entity, const RealType& time = 0.0 ) const { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& hx_div = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hy_div = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hz_div = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); const RealType& u_c = u[ center ]; const RealType u_x_f = ( u[ east ] - u_c ); @@ -317,14 +322,14 @@ class OneSidedNonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex > Vector& b ) const { typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); const RealType lambda_x = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); diff --git a/src/TNL/Operators/euler/fvm/LaxFridrichs.h b/src/TNL/Operators/euler/fvm/LaxFridrichs.h index 60e0a86246ca6b6eaebccb5d7f92217d9ff8f267..8033c80f97d665cc642bbbf11868a4e44b910273 100644 --- a/src/TNL/Operators/euler/fvm/LaxFridrichs.h +++ b/src/TNL/Operators/euler/fvm/LaxFridrichs.h @@ -37,7 +37,7 @@ class LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressu typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename MeshType :: VertexType VertexType; + typedef typename MeshType :: PointType PointType; typedef typename MeshType :: CoordinatesType CoordinatesType; LaxFridrichs(); @@ -106,7 +106,7 @@ class LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeomet typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef typename MeshType :: VertexType VertexType; + typedef typename MeshType :: PointType PointType; typedef typename MeshType :: CoordinatesType CoordinatesType; LaxFridrichs(); diff --git a/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h b/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h index 88a780ad3bdf4a5da12e0d167b90dfb56938335e..428be093a8656461dee19a1bdc126cc0cb080cad 100644 --- a/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h +++ b/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h @@ -151,10 +151,10 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressur TNL_ASSERT( pressureGradient, std::cerr << "No pressure gradient was set in the the Lax-Fridrichs scheme." ) const IndexType& c = centralVolume; - const IndexType e = this->mesh -> getElementNeighbour( centralVolume, 1, 0 ); - const IndexType w = this->mesh -> getElementNeighbour( centralVolume, -1, 0 ); - const IndexType n = this->mesh -> getElementNeighbour( centralVolume, 0, 1 ); - const IndexType s = this->mesh -> getElementNeighbour( centralVolume, 0, -1 ); + const IndexType e = this->mesh -> getElementNeighbor( centralVolume, 1, 0 ); + const IndexType w = this->mesh -> getElementNeighbor( centralVolume, -1, 0 ); + const IndexType n = this->mesh -> getElementNeighbor( centralVolume, 0, 1 ); + const IndexType s = this->mesh -> getElementNeighbor( centralVolume, 0, -1 ); const RealType u1_e = rho_u1[ e ] / regularize( rho[ e ] ); const RealType u1_w = rho_u1[ w ] / regularize( rho[ w ] ); @@ -168,7 +168,7 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressur const RealType u2_w = rho_u2[ w ] / regularize( rho[ w ] ); /**** - * Get the central volume and its neighbours (east, north, west, south) coordinates + * Get the central volume and its neighbors (east, north, west, south) coordinates */ CoordinatesType c_coordinates, e_coordinates, n_coordinates, w_coordinates, s_coordinates; this->mesh -> getElementCoordinates( c, c_coordinates ); @@ -190,7 +190,7 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressur /**** * Get the edge normals */ - VertexType e_normal, w_normal, n_normal, s_normal; + PointType e_normal, w_normal, n_normal, s_normal; this->mesh -> template getEdgeNormal< 1, 0 >( c_coordinates, e_normal ); this->mesh -> template getEdgeNormal< -1, 0 >( c_coordinates, w_normal ); this->mesh -> template getEdgeNormal< 0, 1 >( c_coordinates, n_normal ); @@ -229,7 +229,7 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressur /**** * Compute the pressure gradient */ - VertexType grad_p; + PointType grad_p; pressureGradient -> getGradient( c, grad_p ); /**** @@ -407,10 +407,10 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometr const RealType hy = this->mesh -> getParametricStep(). y(); const IndexType& c = centralVolume; - const IndexType e = this->mesh -> getElementNeighbour( centralVolume, 1, 0 ); - const IndexType w = this->mesh -> getElementNeighbour( centralVolume, -1, 0 ); - const IndexType n = this->mesh -> getElementNeighbour( centralVolume, 0, 1 ); - const IndexType s = this->mesh -> getElementNeighbour( centralVolume, 0, -1 ); + const IndexType e = this->mesh -> getElementNeighbor( centralVolume, 1, 0 ); + const IndexType w = this->mesh -> getElementNeighbor( centralVolume, -1, 0 ); + const IndexType n = this->mesh -> getElementNeighbor( centralVolume, 0, 1 ); + const IndexType s = this->mesh -> getElementNeighbor( centralVolume, 0, -1 ); /**** * rho_t + ( rho u_1 )_x + ( rho u_2 )_y = 0 @@ -426,7 +426,7 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometr /**** * Compute the pressure gradient */ - VertexType grad_p; + PointType grad_p; pressureGradient -> getGradient( c, grad_p ); /**** @@ -465,10 +465,10 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometr const RealType hy = this->mesh -> getParametricStep(). y(); const IndexType& c = centralVolume; - const IndexType e = this->mesh -> getElementNeighbour( centralVolume, 1, 0 ); - const IndexType w = this->mesh -> getElementNeighbour( centralVolume, -1, 0 ); - const IndexType n = this->mesh -> getElementNeighbour( centralVolume, 0, 1 ); - const IndexType s = this->mesh -> getElementNeighbour( centralVolume, 0, -1 ); + const IndexType e = this->mesh -> getElementNeighbor( centralVolume, 1, 0 ); + const IndexType w = this->mesh -> getElementNeighbor( centralVolume, -1, 0 ); + const IndexType n = this->mesh -> getElementNeighbor( centralVolume, 0, 1 ); + const IndexType s = this->mesh -> getElementNeighbor( centralVolume, 0, -1 ); /**** * rho_t + ( rho u_1 )_x + ( rho u_2 )_y = 0 @@ -484,7 +484,7 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometr /**** * Compute the pressure gradient */ - VertexType grad_p; + PointType grad_p; pressureGradient -> getGradient( c, grad_p ); /**** diff --git a/src/TNL/Operators/fdm/BackwardFiniteDifference.h b/src/TNL/Operators/fdm/BackwardFiniteDifference.h index ae88272967acefb399b582582e04c93a171f5dd6..ecc94c6a4e34bdae4eb61b856a2513edf25da033 100644 --- a/src/TNL/Operators/fdm/BackwardFiniteDifference.h +++ b/src/TNL/Operators/fdm/BackwardFiniteDifference.h @@ -27,7 +27,7 @@ class BackwardFiniteDifference { }; -template< int Dimensions, +template< int Dimension, typename MeshReal, typename MeshDevice, typename MeshIndex, @@ -36,19 +36,19 @@ template< int Dimensions, int ZDifference, typename Real, typename Index > -class BackwardFiniteDifference< Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index > -: public Operator< Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex >, - Functions::MeshInteriorDomain, Dimensions, Dimensions, Real, Index > +class BackwardFiniteDifference< Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index > +: public Operator< Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex >, + Functions::MeshInteriorDomain, Dimension, Dimension, Real, Index > { public: - typedef Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex > MeshType; + typedef Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType; typedef Real RealType; typedef MeshDevice DeviceType; typedef Index IndexType; - typedef ExactDifference< Dimensions, XDifference, YDifference, ZDifference > ExactOperatorType; + typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType; - static constexpr int getMeshDimensions() { return Dimensions; } + static constexpr int getDimension() { return Dimension; } static String getType() { @@ -67,7 +67,7 @@ class BackwardFiniteDifference< Meshes::Grid< Dimensions, MeshReal, MeshDevice, const MeshEntity& entity, const RealType& time = 0.0 ) const { - static_assert( MeshFunction::getEntitiesDimensions() == Dimensions, + static_assert( MeshFunction::getEntitiesDimension() == Dimension, "Finite differences can be evaluate only on mesh cells, i.e. the dimensions count of the mesh entities of mesh function must be the same as mesh dimensions count." ); const int XDirection = -1 * ( XDifference != 0 ); const int YDirection = -1 * ( YDifference != 0 ); diff --git a/src/TNL/Operators/fdm/CentralFiniteDifference.h b/src/TNL/Operators/fdm/CentralFiniteDifference.h index 3d2bbe7a413d72e1883c16a015c85354e540c68f..a9514d9f3e9354505d72aa675f6cdc0a76a16382 100644 --- a/src/TNL/Operators/fdm/CentralFiniteDifference.h +++ b/src/TNL/Operators/fdm/CentralFiniteDifference.h @@ -27,7 +27,7 @@ class CentralFiniteDifference { }; -template< int Dimensions, +template< int Dimension, typename MeshReal, typename MeshDevice, typename MeshIndex, @@ -36,19 +36,19 @@ template< int Dimensions, int ZDifference, typename Real, typename Index > -class CentralFiniteDifference< Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index > -: public Operator< Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex >, - Functions::MeshInteriorDomain, Dimensions, Dimensions, Real, Index > +class CentralFiniteDifference< Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index > +: public Operator< Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex >, + Functions::MeshInteriorDomain, Dimension, Dimension, Real, Index > { public: - typedef Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex > MeshType; + typedef Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType; typedef Real RealType; typedef MeshDevice DeviceType; typedef Index IndexType; - typedef ExactDifference< Dimensions, XDifference, YDifference, ZDifference > ExactOperatorType; + typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType; - //static constexpr int getMeshDimensions() { return Dimensions; } + //static constexpr int getDimension() { return Dimension; } static String getType() { @@ -68,7 +68,7 @@ class CentralFiniteDifference< Meshes::Grid< Dimensions, MeshReal, MeshDevice, M const MeshEntity& entity, const RealType& time = 0.0 ) const { - static_assert( MeshFunction::getEntitiesDimensions() == Dimensions, + static_assert( MeshFunction::getEntitiesDimension() == Dimension, "Finite differences can be evaluate only on mesh cells, i.e. the dimensions count of the mesh entities of mesh function must be the same as mesh dimensions count." ); return FiniteDifferences< MeshType, Real, Index, XDifference, YDifference, ZDifference, 0, 0, 0 >::getValue( u, entity ); }; diff --git a/src/TNL/Operators/fdm/ExactDifference.h b/src/TNL/Operators/fdm/ExactDifference.h index 7acf467edfd4f575c62ee8b2b6207fd56b58fd9a..5efffc1b8436a529a4478561fde9326bc323787c 100644 --- a/src/TNL/Operators/fdm/ExactDifference.h +++ b/src/TNL/Operators/fdm/ExactDifference.h @@ -13,19 +13,19 @@ namespace TNL { namespace Operators { -template< int Dimensions, +template< int Dimension, int XDerivative, int YDerivative, int ZDerivative > class ExactDifference - : public Functions::Domain< Dimensions, Functions::SpaceDomain > + : public Functions::Domain< Dimension, Functions::SpaceDomain > { public: static String getType() { return String( "ExactDifference< " ) + - String( Dimensions ) + ", " + + String( Dimension ) + ", " + String( XDerivative ) + ", " + String( YDerivative ) + ", " + String( ZDerivative ) + " >"; @@ -35,7 +35,7 @@ class ExactDifference __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& vertex, + const typename Function::PointType& vertex, const typename Function::RealType& time = 0 ) const { return function.template getPartialDerivative< diff --git a/src/TNL/Operators/fdm/FiniteDifferences_1D.h b/src/TNL/Operators/fdm/FiniteDifferences_1D.h index 127d454d159ff058ce5e3d7ec5afd7e6b820f228..622e4c4585169179df679ca352610d06dd2ec4e1 100644 --- a/src/TNL/Operators/fdm/FiniteDifferences_1D.h +++ b/src/TNL/Operators/fdm/FiniteDifferences_1D.h @@ -66,10 +66,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 1 >()] - u_c ) * hxDiv; + return ( u[ neighborEntities.template getEntityIndex< 1 >()] - u_c ) * hxDiv; } }; @@ -93,10 +93,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u_c - u[ neighbourEntities.template getEntityIndex< -1 >()] ) * hxDiv; + return ( u_c - u[ neighborEntities.template getEntityIndex< -1 >()] ) * hxDiv; } }; @@ -120,10 +120,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >(); - return ( u[ neighbourEntities.template getEntityIndex< 1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * ( 0.5 * hxDiv ); + return ( u[ neighborEntities.template getEntityIndex< 1 >() ] - + u[ neighborEntities.template getEntityIndex< -1 >() ] ) * ( 0.5 * hxDiv ); } }; @@ -147,12 +147,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 2 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 2 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 1 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 1 >() ] ) * hxSquareDiv; } }; @@ -173,12 +173,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< -2 >() ] - + return ( u[ neighborEntities.template getEntityIndex< -2 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv; } }; @@ -199,12 +199,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 1 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 1 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv; } }; diff --git a/src/TNL/Operators/fdm/FiniteDifferences_2D.h b/src/TNL/Operators/fdm/FiniteDifferences_2D.h index d287b50d210d36abdbe9d373bc4b1567aa70968c..4ea67b93159038745e137e0c6decc17c234e720e 100644 --- a/src/TNL/Operators/fdm/FiniteDifferences_2D.h +++ b/src/TNL/Operators/fdm/FiniteDifferences_2D.h @@ -66,10 +66,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 1, 0 >()] - u_c ) * hxDiv; + return ( u[ neighborEntities.template getEntityIndex< 1, 0 >()] - u_c ) * hxDiv; } }; @@ -90,10 +90,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 1 >()] - u_c ) * hyDiv; + return ( u[ neighborEntities.template getEntityIndex< 0, 1 >()] - u_c ) * hyDiv; } }; @@ -117,10 +117,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u_c - u[ neighbourEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv; + return ( u_c - u[ neighborEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv; } }; @@ -141,10 +141,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u_c - u[ neighbourEntities.template getEntityIndex< 0, -1 >()] ) * hyDiv; + return ( u_c - u[ neighborEntities.template getEntityIndex< 0, -1 >()] ) * hyDiv; } }; @@ -168,10 +168,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); - return ( u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * ( 0.5 * hxDiv ); + return ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * ( 0.5 * hxDiv ); } }; @@ -192,10 +192,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); - return ( u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * ( 0.5 * hyDiv ); + return ( u[ neighborEntities.template getEntityIndex< 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * ( 0.5 * hyDiv ); } }; @@ -220,12 +220,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2,0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 2, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 2, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 1, 0 >() ] ) * hxSquareDiv; } }; @@ -246,12 +246,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< -2, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< -2, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv; } }; @@ -272,12 +272,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv; } }; @@ -298,12 +298,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 2 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, 2 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 0, 1 >() ] ) * hxSquareDiv; } }; @@ -324,12 +324,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, -2 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, -2 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * hxSquareDiv; } }; @@ -351,12 +351,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const Real& hySquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, 1 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * hySquareDiv; + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * hySquareDiv; } }; diff --git a/src/TNL/Operators/fdm/FiniteDifferences_3D.h b/src/TNL/Operators/fdm/FiniteDifferences_3D.h index 569a1c7645e4bf5904875ac208dab390c601050d..895aeaddac1be89b57b308becf80b27cd9576c4d 100644 --- a/src/TNL/Operators/fdm/FiniteDifferences_3D.h +++ b/src/TNL/Operators/fdm/FiniteDifferences_3D.h @@ -33,10 +33,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >()] - u_c ) * hxDiv; + return ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >()] - u_c ) * hxDiv; } }; @@ -57,10 +57,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >()] - u_c ) * hyDiv; + return ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >()] - u_c ) * hyDiv; } }; @@ -81,10 +81,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >()] - u_c ) * hzDiv; + return ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >()] - u_c ) * hzDiv; } }; @@ -108,10 +108,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u_c - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >()] ) * hxDiv; + return ( u_c - u[ neighborEntities.template getEntityIndex< -1, 0, 0 >()] ) * hxDiv; } }; @@ -132,10 +132,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u_c - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >()] ) * hyDiv; + return ( u_c - u[ neighborEntities.template getEntityIndex< 0, -1, 0 >()] ) * hyDiv; } }; @@ -156,10 +156,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u_c - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >()] ) * hzDiv; + return ( u_c - u[ neighborEntities.template getEntityIndex< 0, 0, -1 >()] ) * hzDiv; } }; @@ -183,10 +183,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >(); - return ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * ( 0.5 * hxDiv ); + return ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * ( 0.5 * hxDiv ); } }; @@ -207,10 +207,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >(); - return ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * ( 0.5 * hyDiv ); + return ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * ( 0.5 * hyDiv ); } }; @@ -231,10 +231,10 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >(); - return ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * ( 0.5 * hzDiv ); + return ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * ( 0.5 * hzDiv ); } }; @@ -258,12 +258,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 2, 0, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 2, 0, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] ) * hxSquareDiv; } }; @@ -284,12 +284,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< -2, 0, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< -2, 0, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv; } }; @@ -310,12 +310,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv; } }; @@ -336,12 +336,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 2, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, 2, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] ) * hxSquareDiv; } }; @@ -362,12 +362,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, -2, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, -2, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hxSquareDiv; } }; @@ -388,12 +388,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hySquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hySquareDiv; + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hySquareDiv; } }; @@ -414,12 +414,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 0, 2 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, 0, 2 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] ) * hxSquareDiv; } }; @@ -440,12 +440,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hxSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 0, -2 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, 0, -2 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hxSquareDiv; + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hxSquareDiv; } }; @@ -466,12 +466,12 @@ class FiniteDifferences< static Real getValue( const MeshFunction& u, const MeshEntity& entity ) { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const Real& hzSquareDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const Real& u_c = u[ entity.getIndex() ]; - return ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - + return ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - 2.0 * u_c + - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hzSquareDiv; + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hzSquareDiv; } }; diff --git a/src/TNL/Operators/fdm/ForwardFiniteDifference.h b/src/TNL/Operators/fdm/ForwardFiniteDifference.h index 8039f1ee60ca5c5c9f2f627e15df27fb10dad5c3..1de01680cd16c115aaaed34d95437537d3d67e88 100644 --- a/src/TNL/Operators/fdm/ForwardFiniteDifference.h +++ b/src/TNL/Operators/fdm/ForwardFiniteDifference.h @@ -28,7 +28,7 @@ class ForwardFiniteDifference { }; -template< int Dimensions, +template< int Dimension, typename MeshReal, typename MeshDevice, typename MeshIndex, @@ -37,19 +37,19 @@ template< int Dimensions, int ZDifference, typename Real, typename Index > -class ForwardFiniteDifference< Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index > -: public Operator< Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex >, - Functions::MeshInteriorDomain, Dimensions, Dimensions, Real, Index > +class ForwardFiniteDifference< Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index > +: public Operator< Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex >, + Functions::MeshInteriorDomain, Dimension, Dimension, Real, Index > { public: - typedef Meshes::Grid< Dimensions, MeshReal, MeshDevice, MeshIndex > MeshType; + typedef Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType; typedef Real RealType; typedef MeshDevice DeviceType; typedef Index IndexType; - typedef ExactDifference< Dimensions, XDifference, YDifference, ZDifference > ExactOperatorType; + typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType; - static constexpr int getMeshDimensions() { return Dimensions; } + static constexpr int getDimension() { return Dimension; } static String getType() { @@ -69,7 +69,7 @@ class ForwardFiniteDifference< Meshes::Grid< Dimensions, MeshReal, MeshDevice, M const MeshEntity& entity, const RealType& time = 0.0 ) const { - static_assert( MeshFunction::getEntitiesDimensions() == Dimensions, + static_assert( MeshFunction::getEntitiesDimension() == Dimension, "Finite differences can be evaluate only on mesh cells, i.e. the dimensions count of the mesh entities of mesh function must be the same as mesh dimensions count." ); const int XDirection = 1 * ( XDifference != 0 ); const int YDirection = 1 * ( YDifference != 0 ); diff --git a/src/TNL/Operators/geometric/CoFVMGradientNorm.h b/src/TNL/Operators/geometric/CoFVMGradientNorm.h index af7c8c75de76a693ff4a19c97cf92291d6edf245..70b4da29c58e8892740056aa309c3fd24f27ec04 100644 --- a/src/TNL/Operators/geometric/CoFVMGradientNorm.h +++ b/src/TNL/Operators/geometric/CoFVMGradientNorm.h @@ -20,36 +20,36 @@ namespace TNL { namespace Operators { template< typename Mesh, - int MeshEntityDimensions = Mesh::getMeshDimensions(), + int MeshEntityDimension = Mesh::getMeshDimension(), typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class CoFVMGradientNorm { }; -template< int MeshDimensions, +template< int MeshDimension, typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index > -class CoFVMGradientNorm< Meshes::Grid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshDimensions, Real, Index > +class CoFVMGradientNorm< Meshes::Grid< MeshDimension, MeshReal, Device, MeshIndex >, MeshDimension, Real, Index > : public OperatorComposition< - MeshEntitiesInterpolants< Meshes::Grid< MeshDimensions, MeshReal, Device, MeshIndex >, - MeshDimensions - 1, - MeshDimensions >, - CoFVMGradientNorm< Meshes::Grid< MeshDimensions, MeshReal, Device, MeshIndex >, MeshDimensions - 1, Real, Index > > + MeshEntitiesInterpolants< Meshes::Grid< MeshDimension, MeshReal, Device, MeshIndex >, + MeshDimension - 1, + MeshDimension >, + CoFVMGradientNorm< Meshes::Grid< MeshDimension, MeshReal, Device, MeshIndex >, MeshDimension - 1, Real, Index > > { public: - typedef Meshes::Grid< MeshDimensions, MeshReal, Device, MeshIndex > MeshType; + typedef Meshes::Grid< MeshDimension, MeshReal, Device, MeshIndex > MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef CoFVMGradientNorm< MeshType, MeshDimensions - 1, Real, Index > InnerOperator; - typedef MeshEntitiesInterpolants< MeshType, MeshDimensions - 1, MeshDimensions > OuterOperator; + typedef CoFVMGradientNorm< MeshType, MeshDimension - 1, Real, Index > InnerOperator; + typedef MeshEntitiesInterpolants< MeshType, MeshDimension - 1, MeshDimension > OuterOperator; typedef OperatorComposition< OuterOperator, InnerOperator > BaseType; - typedef ExactGradientNorm< MeshDimensions, RealType > ExactOperatorType; + typedef ExactGradientNorm< MeshDimension, RealType > ExactOperatorType; typedef SharedPointer< MeshType > MeshPointer; CoFVMGradientNorm( const OuterOperator& outerOperator, @@ -62,7 +62,7 @@ class CoFVMGradientNorm< Meshes::Grid< MeshDimensions, MeshReal, Device, MeshInd { return String( "CoFVMGradientNorm< " ) + MeshType::getType() + ", " + - String( MeshDimensions ) + ", " + + String( MeshDimension ) + ", " + TNL::getType< Real >() + ", " + TNL::getType< Index >() + " >"; } @@ -72,8 +72,8 @@ class CoFVMGradientNorm< Meshes::Grid< MeshDimensions, MeshReal, Device, MeshInd this->getInnerOperator().setEps( eps ); } - static constexpr int getPreimageEntitiesDimensions() { return MeshDimensions; }; - static constexpr int getImageEntitiesDimensions() { return MeshDimensions; }; + static constexpr int getPreimageEntitiesDimension() { return MeshDimension; }; + static constexpr int getImageEntitiesDimension() { return MeshDimension; }; }; @@ -94,8 +94,8 @@ class CoFVMGradientNorm< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, 0, Real, typedef Index IndexType; typedef ExactGradientNorm< 1, RealType > ExactOperatorType; - constexpr static int getPreimageEntitiesDimensions() { return MeshType::getMeshDimensions(); }; - constexpr static int getImageEntitiesDimensions() { return MeshType::getMeshDimensions() - 1; }; + constexpr static int getPreimageEntitiesDimension() { return MeshType::getMeshDimension(); }; + constexpr static int getImageEntitiesDimension() { return MeshType::getMeshDimension() - 1; }; CoFVMGradientNorm() : epsSquare( 0.0 ){} @@ -114,15 +114,15 @@ class CoFVMGradientNorm< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, 0, Real, const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getDimensions() == 1, + static_assert( MeshFunction::getMeshDimension() == 1, "The mesh function u must be stored on mesh cells.." ); - static_assert( MeshEntity::getDimensions() == 0, + static_assert( MeshEntity::getMeshDimension() == 0, "The complementary finite volume gradient norm may be evaluated only on faces." ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.template getNeighbourEntities< 1 >(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.template getNeighborEntities< 1 >(); const RealType& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >(); - const RealType& u_x = ( u[ neighbourEntities.template getEntityIndex< 1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * hxDiv; + const RealType& u_x = ( u[ neighborEntities.template getEntityIndex< 1 >() ] - + u[ neighborEntities.template getEntityIndex< -1 >() ] ) * hxDiv; return ::sqrt( this->epsSquare + ( u_x * u_x ) ); } @@ -154,8 +154,8 @@ class CoFVMGradientNorm< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real typedef Index IndexType; typedef ExactGradientNorm< 2, RealType > ExactOperatorType; - constexpr static int getPreimageEntitiesDimensions() { return MeshType::getMeshDimensions(); }; - constexpr static int getImageEntitiesDimensions() { return MeshType::getMeshDimensions() - 1; }; + constexpr static int getPreimageEntitiesDimension() { return MeshType::getMeshDimension(); }; + constexpr static int getImageEntitiesDimension() { return MeshType::getMeshDimension() - 1; }; CoFVMGradientNorm() : epsSquare( 0.0 ){} @@ -176,41 +176,41 @@ class CoFVMGradientNorm< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getDimensions() == 2, + static_assert( MeshFunction::getMeshDimension() == 2, "The mesh function u must be stored on mesh cells.." ); - static_assert( MeshEntity::getDimensions() == 1, + static_assert( MeshEntity::getMeshDimension() == 1, "The complementary finite volume gradient norm may be evaluated only on faces." ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.template getNeighbourEntities< 2 >(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.template getNeighborEntities< 2 >(); const RealType& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >(); const RealType& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >(); if( entity.getOrientation().x() != 0.0 ) { const RealType u_x = - ( u[ neighbourEntities.template getEntityIndex< 1, 0 >()] - - u[ neighbourEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0 >()] - + u[ neighborEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv; RealType u_y; if( entity.getCoordinates().y() > 0 ) { if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) u_y = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1 >() ] ) * hyDiv; else // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) u_y = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1 >() ] ) * hyDiv; } else // if( entity.getCoordinates().y() > 0 ) { u_y = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * hyDiv; } return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y ); } @@ -219,28 +219,28 @@ class CoFVMGradientNorm< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real { if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) u_x = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1 >() ] ) * hxDiv; else // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) u_x = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1 >() ] ) * hxDiv; } else // if( entity.getCoordinates().x() > 0 ) { u_x = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * hxDiv; } const RealType u_y = - ( u[ neighbourEntities.template getEntityIndex< 0, 1 >()] - - u[ neighbourEntities.template getEntityIndex< 0, -1 >()] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1 >()] - + u[ neighborEntities.template getEntityIndex< 0, -1 >()] ) * hyDiv; return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y ); } @@ -272,8 +272,8 @@ class CoFVMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real typedef Index IndexType; typedef ExactGradientNorm< 3, RealType > ExactOperatorType; - constexpr static int getPreimageEntitiesDimensions() { return MeshType::getMeshDimensions(); }; - constexpr static int getImageEntitiesDimensions() { return MeshType::getMeshDimensions() - 1; }; + constexpr static int getPreimageEntitiesDimension() { return MeshType::getMeshDimension(); }; + constexpr static int getImageEntitiesDimension() { return MeshType::getMeshDimension() - 1; }; CoFVMGradientNorm() : epsSquare( 0.0 ){} @@ -292,47 +292,47 @@ class CoFVMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getDimensions() == 3, + static_assert( MeshFunction::getMeshDimension() == 3, "The mesh function u must be stored on mesh cells.." ); - static_assert( MeshEntity::getDimensions() == 2, + static_assert( MeshEntity::getMeshDimension() == 2, "The complementary finite volume gradient norm may be evaluated only on faces." ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.template getNeighbourEntities< 3 >(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.template getNeighborEntities< 3 >(); const RealType& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >(); const RealType& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >(); const RealType& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >(); if( entity.getOrientation().x() != 0.0 ) { const RealType u_x = - ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >()] - - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >()] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >()] - + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >()] ) * hxDiv; RealType u_y; if( entity.getCoordinates().y() > 0 ) { if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) { u_y = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, -1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 1, -1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hyDiv; } else // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) { u_y = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, -1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 1, -1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hyDiv; } } else // if( entity.getCoordinates().y() > 0 ) { u_y = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hyDiv; } RealType u_z; @@ -341,27 +341,27 @@ class CoFVMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 ) { u_z = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 1, 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, 0, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hzDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 1, 0, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hzDiv; } else //if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 ) { u_z = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, 0, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hzDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 1, 0, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hzDiv; } } else //if( entity.getCoordinates().z() > 0 ) { u_z = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hzDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< -1, 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hzDiv; } return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z ); } @@ -373,58 +373,58 @@ class CoFVMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) { u_x = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, -1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, -1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hxDiv; } else // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) { u_x = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< -1, -1, 0 >() ] ) * hxDiv; } } else // if( entity.getCoordinates().x() > 0 ) { u_x = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, -1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, -1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hxDiv; } const RealType u_y = - ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >()] - - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >()] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >()] - + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >()] ) * hyDiv; RealType u_z; if( entity.getCoordinates().z() > 0 ) { if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 ) { u_z = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 0, 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hzDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hzDiv; } else // if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 ) { u_z = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hzDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hzDiv; } } else // if( entity.getCoordinates().z() > 0 ) { u_z = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 0, 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hzDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hzDiv; } return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z ); } @@ -434,28 +434,28 @@ class CoFVMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) { u_x = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 1, 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 0, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hxDiv; } else // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) { u_x = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< -1, 0, -1 >() ] ) * hxDiv; } } else // if( entity.getCoordinates().x() > 0 ) { u_x = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 1, 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 0, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hxDiv; + ( u[ neighborEntities.template getEntityIndex< 1, 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0, -1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hxDiv; } RealType u_y; if( entity.getCoordinates().y() > 0 ) @@ -463,31 +463,31 @@ class CoFVMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) { u_y = 0.25 * - ( u[ neighbourEntities.template getEntityIndex< 0, 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hyDiv; } else //if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) { u_y = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, -1, -1 >() ] ) * hyDiv; } } else //if( entity.getCoordinates().y() > 0 ) { u_y = 0.5 * - ( u[ neighbourEntities.template getEntityIndex< 0, 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 1, -1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hyDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1, -1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hyDiv; } const RealType u_z = - ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >()] - - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >()] ) * hzDiv; + ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >()] - + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >()] ) * hzDiv; return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z ); } diff --git a/src/TNL/Operators/geometric/ExactGradientNorm.h b/src/TNL/Operators/geometric/ExactGradientNorm.h index 0de3d0c6488686fbcc80273e2b8d91284df55d77..48d67a12a8392f3838a5bbc19751325e0e651528 100644 --- a/src/TNL/Operators/geometric/ExactGradientNorm.h +++ b/src/TNL/Operators/geometric/ExactGradientNorm.h @@ -18,7 +18,7 @@ namespace TNL { namespace Operators { -template< int Dimensions, +template< int Dimension, typename Real = double > class ExactGradientNorm {}; @@ -49,7 +49,7 @@ class ExactGradientNorm< 1, Real > __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { typedef typename Function::RealType RealType; @@ -64,7 +64,7 @@ class ExactGradientNorm< 1, Real > __cuda_callable__ typename Function::RealType getPartialDerivative( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0, @@ -117,7 +117,7 @@ class ExactGradientNorm< 2, Real > __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { typedef typename Function::RealType RealType; @@ -133,7 +133,7 @@ class ExactGradientNorm< 2, Real > __cuda_callable__ typename Function::RealType getPartialDerivative( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0, @@ -191,7 +191,7 @@ class ExactGradientNorm< 3, Real > __cuda_callable__ typename Function::RealType operator()( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { typedef typename Function::RealType RealType; @@ -208,7 +208,7 @@ class ExactGradientNorm< 3, Real > __cuda_callable__ typename Function::RealType getPartialDerivative( const Function& function, - const typename Function::VertexType& v, + const typename Function::PointType& v, const typename Function::RealType& time = 0.0 ) const { static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0, diff --git a/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h b/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h index 31207e35e80292fa44717290dec5b4eab2f3082f..ca9381d1f418e1a033d39c4619678b94856afc63 100644 --- a/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h +++ b/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h @@ -17,7 +17,7 @@ namespace TNL { namespace Operators { template< typename Mesh, - int InEntityDimensions, + int InEntityDimension, int OutEntityDimenions > class MeshEntitiesInterpolants { @@ -42,16 +42,16 @@ class MeshEntitiesInterpolants< Meshes::Grid< 1, Real, Device, Index >, 1, 0 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntityDimensions() == 1, + static_assert( MeshFunction::getEntityDimension() == 1, "Mesh function must be defined on cells." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); - return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1 >() ] ); + return 0.5 * ( u[ neighborEntities.template getEntityIndex< -1 >() ] + + u[ neighborEntities.template getEntityIndex< 1 >() ] ); } }; @@ -74,16 +74,16 @@ class MeshEntitiesInterpolants< Meshes::Grid< 1, Real, Device, Index >, 0, 1 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntitiesDimensions() == 0, + static_assert( MeshFunction::getEntitiesDimension() == 0, "Mesh function must be defined on vertices (or faces in case on 1D grid)." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 0 >& neighbourEntities = entity.template getNeighbourEntities< 0 >(); + const typename MeshEntity::template NeighborEntities< 0 >& neighborEntities = entity.template getNeighborEntities< 0 >(); - return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1 >() ] ); + return 0.5 * ( u[ neighborEntities.template getEntityIndex< -1 >() ] + + u[ neighborEntities.template getEntityIndex< 1 >() ] ); } }; @@ -106,20 +106,20 @@ class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 2, 1 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntityDimensions() == 2, + static_assert( MeshFunction::getEntityDimension() == 2, "Mesh function must be defined on cells." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); if( entity.getOrientation().x() == 1.0 ) - return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] ); + return 0.5 * ( u[ neighborEntities.template getEntityIndex< -1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0 >() ] ); else - return 0.5 * ( u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] ); + return 0.5 * ( u[ neighborEntities.template getEntityIndex< 0, -1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1 >() ] ); } }; @@ -142,18 +142,18 @@ class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 2, 0 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntityDimensions() == 2, + static_assert( MeshFunction::getEntityDimension() == 2, "Mesh function must be defined on cells." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); - return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, -1 >() ] ); + return 0.25 * ( u[ neighborEntities.template getEntityIndex< -1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< -1, -1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, -1 >() ] ); } }; @@ -176,18 +176,18 @@ class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 1, 2 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntitiesDimensions() == 1, + static_assert( MeshFunction::getEntitiesDimension() == 1, "Mesh function must be defined on faces." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.template getNeighbourEntities< 1 >(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.template getNeighborEntities< 1 >(); - return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ); + return 0.25 * ( u[ neighborEntities.template getEntityIndex< -1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ); } }; @@ -210,18 +210,18 @@ class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 0, 2 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntityDimensions() == 1, + static_assert( MeshFunction::getEntityDimension() == 1, "Mesh function must be defined on vertices." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 0 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 0 >& neighborEntities = entity.getNeighborEntities(); - return 0.25 * ( u[ neighbourEntities.template getEntityIndex< -1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1, -1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, -1 >() ] ); + return 0.25 * ( u[ neighborEntities.template getEntityIndex< -1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 1 >() ] + + u[ neighborEntities.template getEntityIndex< -1, -1 >() ] + + u[ neighborEntities.template getEntityIndex< 1, -1 >() ] ); } }; @@ -244,23 +244,23 @@ class MeshEntitiesInterpolants< Meshes::Grid< 3, Real, Device, Index >, 3, 2 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntityDimensions() == 3, + static_assert( MeshFunction::getEntityDimension() == 3, "Mesh function must be defined on cells." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); if( entity.getOrientation().x() == 1.0 ) - return 0.5 * ( u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] ); + return 0.5 * ( u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] ); if( entity.getOrientation().y() == 1.0 ) - return 0.5 * ( u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] ); + return 0.5 * ( u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] ); else - return 0.5 * ( u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] ); + return 0.5 * ( u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] ); } }; @@ -283,20 +283,20 @@ class MeshEntitiesInterpolants< Meshes::Grid< 3, Real, Device, Index >, 2, 3 > const MeshEntity& entity, const Real& time = 0.0 ) const { - static_assert( MeshFunction::getEntitiesDimensions() == 2, + static_assert( MeshFunction::getEntitiesDimension() == 2, "Mesh function must be defined on faces." ); static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value, "The mesh entity belongs to other mesh type then the interpolants." ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.template getNeighbourEntities< 2 >(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.template getNeighborEntities< 2 >(); - return 1.0 / 6.0 * ( u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] ); + return 1.0 / 6.0 * ( u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] + + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] ); } }; diff --git a/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h b/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h index 4338bbe680660c5a0c1edff4a00d0b7b7feeb01c..9a974d0fada826ebd45f3e94f4c246eadddebd45 100644 --- a/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h +++ b/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h @@ -242,7 +242,7 @@ void tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >:: update( const MeshType& mesh, const RealType& time ) { - CoordinatesType dimensions = mesh.getDimensions(); + CoordinatesType dimensions = mesh.getMeshDimension(); CoordinatesType coordinates; for( coordinates.x()=1; coordinates.x() < dimensions.x()-1; coordinates.x()++ ) @@ -270,37 +270,37 @@ boundaryDerivative( const IndexType& dy, const IndexType& dz ) const { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const IndexType& cellIndex = entity.getIndex(); if ( ( AxeX == 1 ) && ( AxeY == 0 ) && ( AxeZ == 0 ) ) { if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0 >() * ( u[ neighbourEntities.template getEntityIndex< 1,0 >() ] - u[ cellIndex ] ); + return mesh.template getSpaceStepsProducts< -1, 0 >() * ( u[ neighborEntities.template getEntityIndex< 1,0 >() ] - u[ cellIndex ] ); if ( ( dx == -1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0 >() * ( u[ cellIndex ] - u[ neighbourEntities.template getEntityIndex< -1,0 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0 >() * ( u[ cellIndex ] - u[ neighborEntities.template getEntityIndex< -1,0 >() ] ); if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 1,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,1 >() ] - u[ neighbourEntities.template getEntityIndex< -1,0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,1 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 1,0 >() ] + + u[ neighborEntities.template getEntityIndex< 1,1 >() ] - u[ neighborEntities.template getEntityIndex< -1,0 >() ] - + u[ neighborEntities.template getEntityIndex< -1,1 >() ] ); if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 1,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,-1 >() ] - u[ neighbourEntities.template getEntityIndex< -1,0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,-1 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 1,0 >() ] + + u[ neighborEntities.template getEntityIndex< 1,-1 >() ] - u[ neighborEntities.template getEntityIndex< -1,0 >() ] - + u[ neighborEntities.template getEntityIndex< -1,-1 >() ] ); } if ( ( AxeX == 0 ) && ( AxeY == 1 ) && ( AxeZ == 0 ) ) { if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1 >() * ( u[ neighbourEntities.template getEntityIndex< 0,1 >() ] - u[ cellIndex ] ); + return mesh.template getSpaceStepsProducts< 0, -1 >() * ( u[ neighborEntities.template getEntityIndex< 0,1 >() ] - u[ cellIndex ] ); if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1 >() * ( u[ cellIndex ] - u[ neighbourEntities.template getEntityIndex< 0,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1 >() * ( u[ cellIndex ] - u[ neighborEntities.template getEntityIndex< 0,-1 >() ] ); if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,-1 >() ] - - u[ neighbourEntities.template getEntityIndex< 1,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,1 >() ] + + u[ neighborEntities.template getEntityIndex< 1,1 >() ] - u[ neighborEntities.template getEntityIndex< 0,-1 >() ] - + u[ neighborEntities.template getEntityIndex< 1,-1 >() ] ); if ( ( dx == -1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1,1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,-1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,1 >() ] + + u[ neighborEntities.template getEntityIndex< -1,1 >() ] - u[ neighborEntities.template getEntityIndex< 0,-1 >() ] - + u[ neighborEntities.template getEntityIndex< -1,-1 >() ] ); } return 0.0; } @@ -321,14 +321,14 @@ operator()( const MeshEntity& entity, const IndexType& dy, const IndexType& dz ) const { - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const IndexType& cellIndex = entity.getIndex(); if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == 0 ) ) - return ::sqrt( this->eps + ( u[ neighbourEntities.template getEntityIndex< 0,1 >() ] - u[ cellIndex ] ) * - ( u[ neighbourEntities.template getEntityIndex< 0,1 >() ] - u[ cellIndex ] ) - * mesh.template getSpaceStepsProducts< 0, -1 >() * mesh.template getSpaceStepsProducts< 0, -1 >() + ( u[ neighbourEntities.template getEntityIndex< 1,0 >() ] - u[ cellIndex ] ) - * ( u[ neighbourEntities.template getEntityIndex< 1,0 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -1, 0 >() * mesh.template getSpaceStepsProducts< -1, 0 >() ); + return ::sqrt( this->eps + ( u[ neighborEntities.template getEntityIndex< 0,1 >() ] - u[ cellIndex ] ) * + ( u[ neighborEntities.template getEntityIndex< 0,1 >() ] - u[ cellIndex ] ) + * mesh.template getSpaceStepsProducts< 0, -1 >() * mesh.template getSpaceStepsProducts< 0, -1 >() + ( u[ neighborEntities.template getEntityIndex< 1,0 >() ] - u[ cellIndex ] ) + * ( u[ neighborEntities.template getEntityIndex< 1,0 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -1, 0 >() * mesh.template getSpaceStepsProducts< -1, 0 >() ); if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) ) return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0 >( mesh, entity, u, time, 1, 0 ) * this->template boundaryDerivative< MeshEntity, Vector,1,0 >( mesh, entity, u, time, 1, 0 ) + @@ -453,7 +453,7 @@ void tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >:: update( const MeshType& mesh, const RealType& time ) { - CoordinatesType dimensions = mesh.getDimensions(); + CoordinatesType dimensions = mesh.getMeshDimension(); CoordinatesType coordinates; for( coordinates.x()=1; coordinates.x() < dimensions.x()-1; coordinates.x()++ ) @@ -480,76 +480,76 @@ boundaryDerivative( const IndexType& dy, const IndexType& dz ) const { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const IndexType& cellIndex = entity.getIndex(); if ( ( AxeX == 1 ) && ( AxeY == 0 ) && ( AxeZ == 0 ) ) { if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * ( u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ] ); + return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * ( u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ] ); if ( ( dx == -1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * ( u[ cellIndex ] - u[ neighbourEntities.template getEntityIndex< -1,0,0 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * ( u[ cellIndex ] - u[ neighborEntities.template getEntityIndex< -1,0,0 >() ] ); if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,1,0 >() ] - u[ neighbourEntities.template getEntityIndex< -1,0,0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,1,0 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] + + u[ neighborEntities.template getEntityIndex< 1,1,0 >() ] - u[ neighborEntities.template getEntityIndex< -1,0,0 >() ] - + u[ neighborEntities.template getEntityIndex< -1,1,0 >() ] ); if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,-1,0 >() ] - u[ neighbourEntities.template getEntityIndex< -1,0,0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,-1,0 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] + + u[ neighborEntities.template getEntityIndex< 1,-1,0 >() ] - u[ neighborEntities.template getEntityIndex< -1,0,0 >() ] - + u[ neighborEntities.template getEntityIndex< -1,-1,0 >() ] ); if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == 1 ) ) - return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,0,1 >() ] - u[ neighbourEntities.template getEntityIndex< -1,0,0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,0,1 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] + + u[ neighborEntities.template getEntityIndex< 1,0,1 >() ] - u[ neighborEntities.template getEntityIndex< -1,0,0 >() ] - + u[ neighborEntities.template getEntityIndex< -1,0,1 >() ] ); if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == -1 ) ) - return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,0,-1 >() ] - u[ neighbourEntities.template getEntityIndex< -1,0,0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,0,-1 >() ] ); + return mesh.template getSpaceStepsProducts< -1, 0, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] + + u[ neighborEntities.template getEntityIndex< 1,0,-1 >() ] - u[ neighborEntities.template getEntityIndex< -1,0,0 >() ] - + u[ neighborEntities.template getEntityIndex< -1,0,-1 >() ] ); } if ( ( AxeX == 0 ) && ( AxeY == 1 ) && ( AxeZ == 0 ) ) { if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ] ); + return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ] ); if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * ( u[ cellIndex ] - u[ neighbourEntities.template getEntityIndex< 0,-1,0 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * ( u[ cellIndex ] - u[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] ); if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,1,0 >() ] - u[ neighbourEntities.template getEntityIndex< 0,-1,0 >() ] - - u[ neighbourEntities.template getEntityIndex< 1,-1,0 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] + + u[ neighborEntities.template getEntityIndex< 1,1,0 >() ] - u[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] - + u[ neighborEntities.template getEntityIndex< 1,-1,0 >() ] ); if ( ( dx == -1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] + - u[ neighbourEntities.template getEntityIndex< -1,1,0 >() ] - u[ neighbourEntities.template getEntityIndex< 0,-1,0 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,-1,0 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] + + u[ neighborEntities.template getEntityIndex< -1,1,0 >() ] - u[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] - + u[ neighborEntities.template getEntityIndex< -1,-1,0 >() ] ); if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == 1 ) ) - return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0,1,1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,-1,0 >() ] - - u[ neighbourEntities.template getEntityIndex< 0,-1,1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] + + u[ neighborEntities.template getEntityIndex< 0,1,1 >() ] - u[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] - + u[ neighborEntities.template getEntityIndex< 0,-1,1 >() ] ); if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == -1 ) ) - return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] + - u[ neighbourEntities.template getEntityIndex< 0,1,-1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,-1,0 >() ] - - u[ neighbourEntities.template getEntityIndex< 0,-1,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, -1, 0 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] + + u[ neighborEntities.template getEntityIndex< 0,1,-1 >() ] - u[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] - + u[ neighborEntities.template getEntityIndex< 0,-1,-1 >() ] ); } if ( ( AxeX == 0 ) && ( AxeY == 0 ) && ( AxeZ == 1 ) ) { if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == 1 ) ) - return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ] ); + return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ] ); if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == -1 ) ) - return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * ( u[ cellIndex ] - u[ neighbourEntities.template getEntityIndex< 0,0,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * ( u[ cellIndex ] - u[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] ); if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] + - u[ neighbourEntities.template getEntityIndex< 1,0,1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,0,-1 >() ] - - u[ neighbourEntities.template getEntityIndex< 1,0,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] + + u[ neighborEntities.template getEntityIndex< 1,0,1 >() ] - u[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] - + u[ neighborEntities.template getEntityIndex< 1,0,-1 >() ] ); if ( ( dx == -1 ) && ( dy == 0 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] + - u[ neighbourEntities.template getEntityIndex< -1,0,1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,0,-1 >() ] - - u[ neighbourEntities.template getEntityIndex< -1,0,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] + + u[ neighborEntities.template getEntityIndex< -1,0,1 >() ] - u[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] - + u[ neighborEntities.template getEntityIndex< -1,0,-1 >() ] ); if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0,1,1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,0,-1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0,1,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] + + u[ neighborEntities.template getEntityIndex< 0,1,1 >() ] - u[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] - + u[ neighborEntities.template getEntityIndex< 0,1,-1 >() ] ); if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) ) - return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] + - u[ neighbourEntities.template getEntityIndex< 0,-1,1 >() ] - u[ neighbourEntities.template getEntityIndex< 0,0,-1 >() ] - - u[ neighbourEntities.template getEntityIndex< 0,-1,-1 >() ] ); + return mesh.template getSpaceStepsProducts< 0, 0, -1 >() * 0.25 * ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] + + u[ neighborEntities.template getEntityIndex< 0,-1,1 >() ] - u[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] - + u[ neighborEntities.template getEntityIndex< 0,-1,-1 >() ] ); } return 0.0; } @@ -571,16 +571,16 @@ operator()( const IndexType& dy, const IndexType& dz ) const { - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const IndexType& cellIndex = entity.getIndex(); if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == 0 ) ) - return ::sqrt( this->eps + ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ] ) * - ( u[ neighbourEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ] ) - * mesh.template getSpaceStepsProducts< 0, -1, 0 >() * mesh.template getSpaceStepsProducts< 0, -1, 0 >() + ( u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ] ) - * ( u[ neighbourEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -1, 0, 0 >() * mesh.template getSpaceStepsProducts< -1, 0, 0 >() - + ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ] ) - * ( u[ neighbourEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< 0, 0, -1 >() * mesh.template getSpaceStepsProducts< 0, 0, -1 >() ); + return ::sqrt( this->eps + ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ] ) * + ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ] ) + * mesh.template getSpaceStepsProducts< 0, -1, 0 >() * mesh.template getSpaceStepsProducts< 0, -1, 0 >() + ( u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ] ) + * ( u[ neighborEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -1, 0, 0 >() * mesh.template getSpaceStepsProducts< -1, 0, 0 >() + + ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ] ) + * ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< 0, 0, -1 >() * mesh.template getSpaceStepsProducts< 0, 0, -1 >() ); if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) ) return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 1, 0, 0 ) * this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 1, 0, 0 ) + diff --git a/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h b/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h index 483680f5a174b11c917fa34b22bc8fdbc47cb788..21f5e44f08ec29fe365de11cfcbb5fb898f9af26 100644 --- a/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h +++ b/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h @@ -58,9 +58,9 @@ operator()( const MeshFunction& u, const Real& time ) const { const IndexType& cellIndex = entity.getIndex(); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); - const RealType& u_x = ( u[ neighbourEntities.template getEntityIndex< 1 >() ] - u[ cellIndex ] ) * + const RealType& u_x = ( u[ neighborEntities.template getEntityIndex< 1 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -1 >(); return ::sqrt( this->epsSquare + u_x * u_x ); } @@ -79,12 +79,12 @@ getValueStriped( const MeshFunction& u, const Real& time ) const { const IndexType& cellIndex = entity.getIndex(); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& u_c = u[ cellIndex ]; - const RealType& u_x_f = ( u[ neighbourEntities.template getEntityIndex< 1 >() ] - u_c ) * + const RealType& u_x_f = ( u[ neighborEntities.template getEntityIndex< 1 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1 >(); - const RealType& u_x_b = ( u_c - u[ neighbourEntities.template getEntityIndex< -1 >() ] ) * + const RealType& u_x_b = ( u_c - u[ neighborEntities.template getEntityIndex< -1 >() ] ) * mesh.template getSpaceStepsProducts< -1 >(); return ::sqrt( this->epsSquare + 0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b ) ); } @@ -134,12 +134,12 @@ operator()( const MeshFunction& u, const Real& time ) const { const IndexType& cellIndex = entity.getIndex(); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& u_c = u[ cellIndex ]; - const RealType u_x = ( u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] - u_c ) * + const RealType u_x = ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1, 0 >(); - const RealType u_y = ( u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - u_c ) * + const RealType u_y = ( u[ neighborEntities.template getEntityIndex< 0, 1 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, -1 >(); return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y ); } @@ -158,16 +158,16 @@ getValueStriped( const MeshFunction& u, const Real& time ) const { const IndexType& cellIndex = entity.getIndex(); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& u_c = u[ cellIndex ]; - const RealType u_x_f = ( u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] - u_c ) * + const RealType u_x_f = ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1, 0 >(); - const RealType u_y_f = ( u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] - u_c ) * + const RealType u_y_f = ( u[ neighborEntities.template getEntityIndex< 0, 1 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, -1 >(); - const RealType u_x_b = ( u_c - u[ neighbourEntities.template getEntityIndex< -1, 0 >() ] ) * + const RealType u_x_b = ( u_c - u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * mesh.template getSpaceStepsProducts< -1, 0 >(); - const RealType u_y_b = ( u_c - u[ neighbourEntities.template getEntityIndex< 0, -1 >() ] ) * + const RealType u_y_b = ( u_c - u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * mesh.template getSpaceStepsProducts< 0, -1 >(); return ::sqrt( this->epsSquare + @@ -219,15 +219,15 @@ operator()( const MeshFunction& u, const Real& time ) const { const IndexType& cellIndex = entity.getIndex(); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& u_c =u[ cellIndex ]; - const RealType u_x = ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) * + const RealType u_x = ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1, 0, 0 >(); - const RealType u_y = ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) * + const RealType u_y = ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, -1, 0 >(); - const RealType u_z = ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - u_c ) * + const RealType u_z = ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, 0, -1 >(); return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z ); } @@ -246,21 +246,21 @@ getValueStriped( const MeshFunction& u, const Real& time ) const { const IndexType& cellIndex = entity.getIndex(); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const typename MeshEntity::MeshType& mesh = entity.getMesh(); const RealType& u_c = u[ cellIndex ]; - const RealType u_x_f = ( u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) * + const RealType u_x_f = ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1, 0, 0 >(); - const RealType u_y_f = ( u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) * + const RealType u_y_f = ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, -1, 0 >(); - const RealType u_z_f = ( u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] - u_c ) * + const RealType u_z_f = ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, 0, -1 >(); - const RealType u_x_b = ( u_c - u[ neighbourEntities.template getEntityIndex< -1, 0, 0 >() ] ) * + const RealType u_x_b = ( u_c - u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * mesh.template getSpaceStepsProducts< -1, 0, 0 >(); - const RealType u_y_b = ( u_c - u[ neighbourEntities.template getEntityIndex< 0, -1, 0 >() ] ) * + const RealType u_y_b = ( u_c - u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * mesh.template getSpaceStepsProducts< 0, -1, 0 >(); - const RealType u_z_b = ( u_c - u[ neighbourEntities.template getEntityIndex< 0, 0, -1 >() ] ) * + const RealType u_z_b = ( u_c - u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * mesh.template getSpaceStepsProducts< 0, 0, -1 >(); return ::sqrt( this->epsSquare + diff --git a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h index 68cf12eda4ade12447205891675ec6a86b314b6c..2c7d15fe99ab715a6a5ea8a98710f3cceddc29ad 100644 --- a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h +++ b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h @@ -18,7 +18,7 @@ namespace TNL { namespace Operators { -template< typename ExactOperatorQ, int Dimensions > +template< typename ExactOperatorQ, int Dimension > class ExactOperatorCurvature {}; @@ -27,20 +27,20 @@ class ExactOperatorCurvature< OperatorQ, 1 > { public: - enum { Dimensions = 1 }; + enum { Dimension = 1 }; static String getType(); #ifdef HAVE_NOT_CXX11 - template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real > + template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real > #else - template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real = typename Vertex::RealType > + template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real = typename Point::RealType > #endif #ifdef HAVE_CUDA __device__ __host__ #endif static Real getValue( const Function& function, - const Vertex& v, + const Point& v, const Real& time = 0.0, const Real& eps = 1.0 ); }; @@ -50,20 +50,20 @@ class ExactOperatorCurvature< ExactOperatorQ, 2 > { public: - enum { Dimensions = 2 }; + enum { Dimension = 2 }; static String getType(); #ifdef HAVE_NOT_CXX11 - template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real > + template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real > #else - template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real = typename Vertex::RealType > + template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real = typename Point::RealType > #endif #ifdef HAVE_CUDA __device__ __host__ #endif static Real getValue( const Function& function, - const Vertex& v, + const Point& v, const Real& time = 0.0, const Real& eps = 1.0 ); }; @@ -72,28 +72,28 @@ class ExactOperatorCurvature< ExactOperatorQ, 3 > { public: - enum { Dimensions = 3 }; + enum { Dimension = 3 }; static String getType(); #ifdef HAVE_NOT_CXX11 - template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real > + template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real > #else - template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real = typename Vertex::RealType > + template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real = typename Point::RealType > #endif #ifdef HAVE_CUDA __device__ __host__ #endif static Real getValue( const Function& function, - const Vertex& v, + const Point& v, const Real& time = 0.0, const Real& eps = 1.0 ) { return 0; } }; -template< typename ExactOperatorQ, int Dimensions > -class tnlFunctionType< ExactOperatorCurvature< ExactOperatorQ, Dimensions > > +template< typename ExactOperatorQ, int Dimension > +class tnlFunctionType< ExactOperatorCurvature< ExactOperatorQ, Dimension > > { public: enum { Type = tnlSpaceDomain }; diff --git a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h index ef268feb31381bc4fe5d534eda2c87c6a2f9dde9..f07610f4b1d777b1a99a05405e3fa44a50eb5bd1 100644 --- a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h +++ b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h @@ -24,21 +24,21 @@ getType() } template< typename OperatorQ > -template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Function, typename Vertex, typename Real > +template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Function, typename Point, typename Real > #ifdef HAVE_CUDA __device__ __host__ #endif Real tnlExactOperatorQ< 1 >:: getValue( const Function& function, - const Vertex& v, + const Point& v, const Real& time, const Real& eps ) { if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if (XDiffOrder == 0) - return function.template getValue< 2, 0, 0, Vertex >( v, time )/ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) - - ( function.template getValue< 1, 0, 0, Vertex >( v, time ) * ExactOperatorQ::template getValue< 1, 0, 0 >( function, v, time, eps ) ) + return function.template getValue< 2, 0, 0, Point >( v, time )/ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) - + ( function.template getValue< 1, 0, 0, Point >( v, time ) * ExactOperatorQ::template getValue< 1, 0, 0 >( function, v, time, eps ) ) / ( ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) * ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) ); return 0; } @@ -51,22 +51,22 @@ getType() return "ExactOperatorCurvature< " + ExactOperatorQ::getType() + ",2 >"; } -template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Function, typename Vertex, typename Real > +template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Function, typename Point, typename Real > #ifdef HAVE_CUDA __device__ __host__ #endif Real tnlExactOperatorQ< 2 >:: getValue( const Function& function, - const Vertex& v, + const Point& v, const Real& time, const Real& eps ) { if( ZDiffOrder != 0 ) return 0.0; if (XDiffOrder == 0 && YDiffOrder == 0 ) - return ( function.template getValue< 2, 0, 0, Vertex >( v, time ) * function.template getValue< 0, 2, 0, Vertex >( v, time ) ) - /ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) - ( function.template getValue< 1, 0, 0, Vertex >( v, time ) * - ExactOperatorQ::template getValue< 1, 0, 0 >( function, v, time, eps ) + function.template getValue< 0, 1, 0, Vertex >( v, time ) * + return ( function.template getValue< 2, 0, 0, Point >( v, time ) * function.template getValue< 0, 2, 0, Point >( v, time ) ) + /ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) - ( function.template getValue< 1, 0, 0, Point >( v, time ) * + ExactOperatorQ::template getValue< 1, 0, 0 >( function, v, time, eps ) + function.template getValue< 0, 1, 0, Point >( v, time ) * ExactOperatorQ::template getValue< 0, 1, 0 >( function, v, time, eps ) ) / ( ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) * ExactOperatorQ::template getValue< 0, 0, 0 >( function, v, time, eps ) ); return 0; diff --git a/src/TNL/Problems/HeatEquationEocRhs.h b/src/TNL/Problems/HeatEquationEocRhs.h index 4243cebb10b806cf40c69146ab0362d7a0753677..c4d8e8a10f0829e60723ec2299ebbf0f027128d5 100644 --- a/src/TNL/Problems/HeatEquationEocRhs.h +++ b/src/TNL/Problems/HeatEquationEocRhs.h @@ -24,14 +24,14 @@ namespace Problems { template< typename ExactOperator, typename TestFunction > class HeatEquationEocRhs - : public Functions::Domain< TestFunction::Dimensions, Functions::SpaceDomain > + : public Functions::Domain< TestFunction::Dimension, Functions::SpaceDomain > { public: typedef ExactOperator ExactOperatorType; typedef TestFunction TestFunctionType; typedef typename TestFunction::RealType RealType; - typedef typename TestFunction::VertexType VertexType; + typedef typename TestFunction::PointType PointType; bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) @@ -42,7 +42,7 @@ class HeatEquationEocRhs } __cuda_callable__ - RealType operator()( const VertexType& vertex, + RealType operator()( const PointType& vertex, const RealType& time = 0.0 ) const { return testFunction.getTimeDerivative( vertex, time ) diff --git a/src/TNL/Problems/HeatEquationProblem.h b/src/TNL/Problems/HeatEquationProblem.h index 25e5a193383a1132a2cc7e38403b258213de6d7a..f446fda8d3dfca9a09aadb45e5352025f8333faf 100644 --- a/src/TNL/Problems/HeatEquationProblem.h +++ b/src/TNL/Problems/HeatEquationProblem.h @@ -22,6 +22,8 @@ #include <TNL/Functions/MeshFunction.h> #include <TNL/Timer.h> #include <TNL/Solvers/PDE/ExplicitUpdater.h> +#include <TNL/Solvers/PDE/LinearSystemAssembler.h> +#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h> namespace TNL { namespace Problems { @@ -120,6 +122,14 @@ class HeatEquationProblem : public PDEProblem< Mesh, Timer gpuTransferTimer; Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; + + Solvers::PDE::LinearSystemAssembler< Mesh, + MeshFunctionType, + DifferentialOperator, + BoundaryCondition, + RightHandSide, + Solvers::PDE::BackwardTimeDiscretisation, + DofVectorType > systemAssembler; }; } // namespace Problems diff --git a/src/TNL/Problems/HeatEquationProblem_impl.h b/src/TNL/Problems/HeatEquationProblem_impl.h index 49058f6a41084b374f0bb03d3ca39a692aa63069..039f983eee5946164d680592260f1f90dbedec21 100644 --- a/src/TNL/Problems/HeatEquationProblem_impl.h +++ b/src/TNL/Problems/HeatEquationProblem_impl.h @@ -21,8 +21,6 @@ #include <TNL/Matrices/MultidiagonalMatrixSetter.h> #include <TNL/Logger.h> #include <TNL/Solvers/PDE/BoundaryConditionsSetter.h> -#include <TNL/Solvers/PDE/LinearSystemAssembler.h> -#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h> #include "HeatEquationProblem.h" @@ -154,18 +152,18 @@ setupLinearSystem( const MeshPointer& meshPointer, MatrixPointer& matrixPointer ) { const IndexType dofs = this->getDofs( meshPointer ); - typedef typename MatrixPointer::ObjectType::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; - SharedPointer< CompressedRowsLengthsVectorType > rowLengthsPointer; + typedef typename MatrixPointer::ObjectType::CompressedRowLengthsVector CompressedRowLengthsVectorType; + SharedPointer< CompressedRowLengthsVectorType > rowLengthsPointer; if( ! rowLengthsPointer->setSize( dofs ) ) return false; - Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; - matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( + Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter; + matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( meshPointer, differentialOperatorPointer, boundaryConditionPointer, rowLengthsPointer ); matrixPointer->setDimensions( dofs, dofs ); - if( ! matrixPointer->setCompressedRowsLengths( *rowLengthsPointer ) ) + if( ! matrixPointer->setCompressedRowLengths( *rowLengthsPointer ) ) return false; return true; //return MultidiagonalMatrixSetter< Mesh >::setupMatrix( mesh, matrix ); @@ -219,27 +217,11 @@ getExplicitUpdate( const RealType& time, */ this->bindDofs( meshPointer, uDofs ); - MeshFunctionPointer fuPointer( meshPointer, fuDofs ); - explicitUpdater.template update< typename Mesh::Cell >( - time, - meshPointer, - this->differentialOperatorPointer, - this->boundaryConditionPointer, - this->rightHandSidePointer, - this->uPointer, - fuPointer ); - //std::cerr << "******************************************************************************************" << std::endl; - //std::cerr << "******************************************************************************************" << std::endl; - //std::cerr << "******************************************************************************************" << std::endl; - /*Solvers::PDE::BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; - boundaryConditionsSetter.template apply< typename Mesh::Cell >( - this->boundaryConditionPointer, - time + tau, - this->uPointer );*/ - - /*uPointer->write( "u.txt", "gnuplot" ); - fuPointer->write( "fu.txt", "gnuplot" ); - getchar();*/ + MeshFunctionPointer fuPointer( meshPointer, fuDofs ); + this->explicitUpdater.setDifferentialOperator( this->differentialOperatorPointer ), + this->explicitUpdater.setBoundaryConditions( this->boundaryConditionPointer ), + this->explicitUpdater.setRightHandSide( this->rightHandSidePointer ), + this->explicitUpdater.template update< typename Mesh::Cell >( time, tau, meshPointer, this->uPointer, fuPointer ); } template< typename Mesh, @@ -258,49 +240,16 @@ assemblyLinearSystem( const RealType& time, MeshDependentDataPointer& meshDependentData ) { this->bindDofs( meshPointer, dofsPointer ); - Solvers::PDE::LinearSystemAssembler< Mesh, - MeshFunctionType, - DifferentialOperator, - BoundaryCondition, - RightHandSide, - Solvers::PDE::BackwardTimeDiscretisation, - typename MatrixPointer::ObjectType, - DofVectorType > systemAssembler; - systemAssembler.template assembly< typename Mesh::Cell >( + this->systemAssembler.setDifferentialOperator( this->differentialOperatorPointer ); + this->systemAssembler.setBoundaryConditions( this->boundaryConditionPointer ); + this->systemAssembler.setRightHandSide( this->rightHandSidePointer ); + this->systemAssembler.template assembly< typename Mesh::Cell, typename MatrixPointer::ObjectType >( time, tau, meshPointer, - this->differentialOperatorPointer, - this->boundaryConditionPointer, - this->rightHandSidePointer, this->uPointer, matrixPointer, bPointer ); - //matrixPointer->print( std::cout ); - //getchar(); - /*cout << endl << b << endl; - cout << endl << u << endl; - abort();*/ - /*cout << "Matrix multiplication test ..." << std::endl; - Vector< RealType, DeviceType, IndexType > y; - y.setLike( u ); - Timer timer; - timer.reset(); - timer.start(); - for( int i = 0; i < 100; i++ ) - matrix.vectorProduct( u, y ); - timer.stop(); - std::cout << "The time is " << timer.getRealTime(); - std::cout << "Scalar product test ..." << std::endl; - timer.reset(); - RealType a; - timer.start(); - for( int i = 0; i < 100; i++ ) - a = y.scalarProduct( u ); - timer.stop(); - std::cout << "The time is " << timer.getRealTime(); - std::cout << std::endl; - abort();*/ } } // namespace Problems diff --git a/src/TNL/Problems/MeanCurvatureFlowEocProblem.h b/src/TNL/Problems/MeanCurvatureFlowEocProblem.h index a756ffea10ecf4c9780ce776024303ca570511ae..057b331bb7a048e9e8f23416e911b9dc443b5743 100644 --- a/src/TNL/Problems/MeanCurvatureFlowEocProblem.h +++ b/src/TNL/Problems/MeanCurvatureFlowEocProblem.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Problems/MeanCurvatureFlowProblem.h> diff --git a/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h b/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h index 57df68026df292fb74af638babcb222875d1ed89..065e39ac6c18a5a2d103c93ea805dd6e1b51a2b6 100644 --- a/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h +++ b/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once namespace TNL { diff --git a/src/TNL/Problems/MeanCurvatureFlowEocRhs.h b/src/TNL/Problems/MeanCurvatureFlowEocRhs.h index cb07a2a13e74fd109a9e9a005e0e5482d19ee52e..8898c8f6bbb00edcfc5cce127e3a3db755302d0b 100644 --- a/src/TNL/Problems/MeanCurvatureFlowEocRhs.h +++ b/src/TNL/Problems/MeanCurvatureFlowEocRhs.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Functions/Domain.h> @@ -17,15 +23,15 @@ namespace Problems { template< typename ExactOperator, typename TestFunction, - int Dimensions > -class MeanCurvatureFlowEocRhs : public Domain< Dimensions, SpaceDomain > + int Dimension > +class MeanCurvatureFlowEocRhs : public Domain< Dimension, SpaceDomain > { public: typedef ExactOperator ExactOperatorType; typedef TestFunction TestFunctionType; typedef typename TestFunctionType::RealType RealType; - typedef StaticVector< Dimensions, RealType > VertexType; + typedef StaticVector< Dimension, RealType > PointType; bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) @@ -35,10 +41,10 @@ class MeanCurvatureFlowEocRhs : public Domain< Dimensions, SpaceDomain > return true; }; - template< typename Vertex, + template< typename Point, typename Real > __cuda_callable__ - Real operator()( const Vertex& vertex, + Real operator()( const Point& vertex, const Real& time ) const { return testFunction.getTimeDerivative( vertex, time ) diff --git a/src/TNL/Problems/MeanCurvatureFlowProblem.h b/src/TNL/Problems/MeanCurvatureFlowProblem.h index af5a34df8c320b7b86d7b1d60acca95e2ad89364..0e7a88df3312b5fde78ec4964b4984ed95500f8d 100644 --- a/src/TNL/Problems/MeanCurvatureFlowProblem.h +++ b/src/TNL/Problems/MeanCurvatureFlowProblem.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/Operators/diffusion/OneSidedMeanCurvature.h> diff --git a/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h b/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h index c9092b12ce64fa409ae83a758fbd32ac1694d909..79c730732fff1fea884d623076e08ce32dc3bf96 100644 --- a/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h +++ b/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h @@ -8,6 +8,12 @@ /* See Copyright Notice in tnl/Copyright */ +/*** + * Authors: + * Oberhuber Tomas, tomas.oberhuber@fjfi.cvut.cz + * Szekely Ondrej, ondra.szekely@gmail.com + */ + #pragma once #include <TNL/FileName.h> @@ -132,19 +138,19 @@ setupLinearSystem( const MeshType& mesh, Matrix& matrix ) { const IndexType dofs = this->getDofs( mesh ); - typedef typename MatrixType::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; - CompressedRowsLengthsVectorType rowLengths; + typedef typename MatrixType::CompressedRowLengthsVector CompressedRowLengthsVectorType; + CompressedRowLengthsVectorType rowLengths; if( ! rowLengths.setSize( dofs ) ) return false; - MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; - matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( + MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter; + matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( mesh, differentialOperator, boundaryCondition, rowLengths ); matrix.setDimensions( dofs, dofs ); - if( ! matrix.setCompressedRowsLengths( rowLengths ) ) + if( ! matrix.setCompressedRowLengths( rowLengths ) ) return false; return true; } @@ -202,21 +208,12 @@ getExplicitUpdate( const RealType& time, MeshFunctionType fu( mesh, outDofs ); //differentialOperator.nonlinearDiffusionOperator.operatorQ.update( mesh, time ); ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; - explicitUpdater.template update< typename Mesh::Cell >( - time, - mesh, - this->differentialOperator, - this->boundaryCondition, - this->rightHandSide, - u, - fu ); + explicitUpdater.setDifferentialOperator( this->differentialOperatorPointer ); + explicitUpdater.setBoundaryConditions( this->boundaryConditionPointer ); + explicitUpdater.setRightHandSide( this->rightHandSidePointer ); + + explicitUpdater.template update< typename Mesh::Cell >( time, tau, mesh, u, fu ); - BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; - boundaryConditionsSetter.template apply< typename Mesh::Cell >( - this->boundaryCondition, - time, - u ); - /*cout << "u = " << u << std::endl; std::cout << "fu = " << fu << std::endl; u.save( "u.tnl" ); diff --git a/src/TNL/Solvers/BuildConfigTags.h b/src/TNL/Solvers/BuildConfigTags.h index 190290299ed5a29cf3a5640c31a9e48d647045c2..003974c3b39c3fae2ce7645803e70a0b5312ea05 100644 --- a/src/TNL/Solvers/BuildConfigTags.h +++ b/src/TNL/Solvers/BuildConfigTags.h @@ -54,7 +54,7 @@ template< typename ConfigTag > struct ConfigTagMeshResolve{ enum { enabled = tru /**** * 1, 2, and 3 dimensions are enabled by default */ -template< typename ConfigTag, int Dimensions > struct ConfigTagDimensions{ enum { enabled = ( Dimensions > 0 && Dimensions <= 3 ) }; }; +template< typename ConfigTag, int Dimension > struct ConfigTagDimension{ enum { enabled = ( Dimension > 0 && Dimension <= 3 ) }; }; /**** * Up to the exceptions enlisted below, all mesh types are disabled by default. @@ -64,9 +64,9 @@ template< typename ConfigTag, typename MeshType > struct ConfigTagMesh{ enum { e /**** * Use of Grid is enabled for allowed dimensions and Real, Device and Index types. */ -template< typename ConfigTag, int Dimensions, typename Real, typename Device, typename Index > - struct ConfigTagMesh< ConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > > - { enum { enabled = ConfigTagDimensions< ConfigTag, Dimensions >::enabled && +template< typename ConfigTag, int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< ConfigTag, Meshes::Grid< Dimension, Real, Device, Index > > + { enum { enabled = ConfigTagDimension< ConfigTag, Dimension >::enabled && ConfigTagReal< ConfigTag, Real >::enabled && ConfigTagDevice< ConfigTag, Device >::enabled && ConfigTagIndex< ConfigTag, Index >::enabled }; }; diff --git a/src/TNL/Solvers/FastBuildConfigTag.h b/src/TNL/Solvers/FastBuildConfigTag.h index c0490f2ccf4a9febfa6708f996d30b4668ffc3e8..45ab71b8d84b447a178f3a1c338b1a9f4cf050ca 100644 --- a/src/TNL/Solvers/FastBuildConfigTag.h +++ b/src/TNL/Solvers/FastBuildConfigTag.h @@ -37,9 +37,9 @@ template<> struct ConfigTagIndex< FastBuildConfig, long int >{ enum { enabled = /**** * Use of Grid is enabled for allowed dimensions and Real, Device and Index types. */ -template< int Dimensions, typename Real, typename Device, typename Index > - struct ConfigTagMesh< FastBuildConfig, Meshes::Grid< Dimensions, Real, Device, Index > > - { enum { enabled = ConfigTagDimensions< FastBuildConfig, Dimensions >::enabled && +template< int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< FastBuildConfig, Meshes::Grid< Dimension, Real, Device, Index > > + { enum { enabled = ConfigTagDimension< FastBuildConfig, Dimension >::enabled && ConfigTagReal< FastBuildConfig, Real >::enabled && ConfigTagDevice< FastBuildConfig, Device >::enabled && ConfigTagIndex< FastBuildConfig, Index >::enabled }; }; diff --git a/src/TNL/Solvers/MeshTypeResolver.h b/src/TNL/Solvers/MeshTypeResolver.h index 604b2dfbe70e4286a6ba5bcb3d00fa39cf7874cc..d24bd8afa89c8d56257dd7d8d38684a7b853e210 100644 --- a/src/TNL/Solvers/MeshTypeResolver.h +++ b/src/TNL/Solvers/MeshTypeResolver.h @@ -50,24 +50,24 @@ class MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true > protected: - static bool resolveMeshDimensions( const Config::ParameterContainer& parameters, + static bool resolveMeshDimension( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ); // Overload for disabled dimensions - template< int MeshDimensions, - typename = typename std::enable_if< ! ConfigTagDimensions<ConfigTag,MeshDimensions>::enabled >::type, + template< int MeshDimension, + typename = typename std::enable_if< ! ConfigTagDimension<ConfigTag,MeshDimension>::enabled >::type, typename = void > static bool resolveMeshRealType( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ); // Overload for enabled dimensions - template< int MeshDimensions, - typename = typename std::enable_if< ConfigTagDimensions<ConfigTag,MeshDimensions>::enabled >::type > + template< int MeshDimension, + typename = typename std::enable_if< ConfigTagDimension<ConfigTag,MeshDimension>::enabled >::type > static bool resolveMeshRealType( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ); // Overload for disabled real types - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename = typename std::enable_if< ! ConfigTagReal<ConfigTag, MeshRealType>::enabled >::type, typename = void > @@ -75,14 +75,14 @@ class MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true > const Containers::List< String >& parsedMeshType ); // Overload for enabled real types - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename = typename std::enable_if< ConfigTagReal<ConfigTag, MeshRealType>::enabled >::type > static bool resolveMeshIndexType( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ); // Overload for disabled index types - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename MeshIndexType, typename = typename std::enable_if< ! ConfigTagIndex<ConfigTag, MeshIndexType>::enabled >::type, @@ -91,7 +91,7 @@ class MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true > const Containers::List< String >& parsedMeshType ); // Overload for enabled index types - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename MeshIndexType, typename = typename std::enable_if< ConfigTagIndex<ConfigTag, MeshIndexType>::enabled >::type > @@ -100,30 +100,30 @@ class MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true > - template< int Dimensions, bool DimensionsSupport, typename MeshTypeResolver > - friend class MeshTypeResolverDimensionsSupportChecker; + template< int Dimension, bool DimensionSupport, typename MeshTypeResolver > + friend class MeshTypeResolverDimensionSupportChecker; }; -/*template< int Dimensions, bool DimensionsSupport, typename MeshTypeResolver > -class MeshTypeResolverDimensionsSupportChecker +/*template< int Dimension, bool DimensionSupport, typename MeshTypeResolver > +class MeshTypeResolverDimensionSupportChecker { }; -template< int Dimensions, typename MeshTypeResolver > -class MeshTypeResolverDimensionsSupportChecker< Dimensions, true, MeshTypeResolver > +template< int Dimension, typename MeshTypeResolver > +class MeshTypeResolverDimensionSupportChecker< Dimension, true, MeshTypeResolver > { public: - static bool checkDimensions( const Config::ParameterContainer& parameters, + static bool checkDimension( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ); }; -template< int Dimensions, typename MeshTypeResolver > -class MeshTypeResolverDimensionsSupportChecker< Dimensions, false, MeshTypeResolver > +template< int Dimension, typename MeshTypeResolver > +class MeshTypeResolverDimensionSupportChecker< Dimension, false, MeshTypeResolver > { public: - static bool checkDimensions( const Config::ParameterContainer& parameters, + static bool checkDimension( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ); };*/ diff --git a/src/TNL/Solvers/MeshTypeResolver_impl.h b/src/TNL/Solvers/MeshTypeResolver_impl.h index d1b1b6d4263387a71f1192c2391b1c8f5217c3d0..c342c58f34204e5e42f163c637bf60aaed2f2df6 100644 --- a/src/TNL/Solvers/MeshTypeResolver_impl.h +++ b/src/TNL/Solvers/MeshTypeResolver_impl.h @@ -65,7 +65,7 @@ bool MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true >::ru std::cerr << "Unable to parse the mesh type " << meshType << "." << std::endl; return false; } - return resolveMeshDimensions( parameters, parsedMeshType ); + return resolveMeshDimension( parameters, parsedMeshType ); } template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter, @@ -75,7 +75,7 @@ template< template< typename Real, typename Device, typename Index, typename Mes typename ConfigTag > bool MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true >:: -resolveMeshDimensions( const Config::ParameterContainer& parameters, +resolveMeshDimension( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ) { int dimensions = atoi( parsedMeshType[ 1 ].getString() ); @@ -86,7 +86,7 @@ resolveMeshDimensions( const Config::ParameterContainer& parameters, return resolveMeshRealType< 2 >( parameters, parsedMeshType ); if( dimensions == 3 ) return resolveMeshRealType< 3 >( parameters, parsedMeshType ); - std::cerr << "Dimensions higher than 3 are not supported." << std::endl; + std::cerr << "Dimension higher than 3 are not supported." << std::endl; return false; } @@ -95,13 +95,13 @@ template< template< typename Real, typename Device, typename Index, typename Mes typename Device, typename Index, typename ConfigTag > - template< int MeshDimensions, typename, typename > + template< int MeshDimension, typename, typename > bool MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true >:: resolveMeshRealType( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ) { - std::cerr << "Mesh dimension " << MeshDimensions << " is not supported." << std::endl; + std::cerr << "Mesh dimension " << MeshDimension << " is not supported." << std::endl; return false; } @@ -110,18 +110,18 @@ template< template< typename Real, typename Device, typename Index, typename Mes typename Device, typename Index, typename ConfigTag > - template< int MeshDimensions, typename > + template< int MeshDimension, typename > bool MeshTypeResolver< ProblemSetter, Real, Device, Index, ConfigTag, true >:: resolveMeshRealType( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ) { if( parsedMeshType[ 2 ] == "float" ) - return resolveMeshIndexType< MeshDimensions, float >( parameters, parsedMeshType ); + return resolveMeshIndexType< MeshDimension, float >( parameters, parsedMeshType ); if( parsedMeshType[ 2 ] == "double" ) - return resolveMeshIndexType< MeshDimensions, double >( parameters, parsedMeshType ); + return resolveMeshIndexType< MeshDimension, double >( parameters, parsedMeshType ); if( parsedMeshType[ 2 ] == "long-double" ) - return resolveMeshIndexType< MeshDimensions, long double >( parameters, parsedMeshType ); + return resolveMeshIndexType< MeshDimension, long double >( parameters, parsedMeshType ); std::cerr << "The type '" << parsedMeshType[ 2 ] << "' is not allowed for real type." << std::endl; return false; } @@ -131,7 +131,7 @@ template< template< typename Real, typename Device, typename Index, typename Mes typename Device, typename Index, typename ConfigTag > - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename, typename > bool @@ -148,7 +148,7 @@ template< template< typename Real, typename Device, typename Index, typename Mes typename Device, typename Index, typename ConfigTag > - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename > bool @@ -157,11 +157,11 @@ resolveMeshIndexType( const Config::ParameterContainer& parameters, const Containers::List< String >& parsedMeshType ) { if( parsedMeshType[ 4 ] == "short int" ) - return resolveMeshType< MeshDimensions, MeshRealType, short int >( parameters, parsedMeshType ); + return resolveMeshType< MeshDimension, MeshRealType, short int >( parameters, parsedMeshType ); if( parsedMeshType[ 4 ] == "int" ) - return resolveMeshType< MeshDimensions, MeshRealType, int >( parameters, parsedMeshType ); + return resolveMeshType< MeshDimension, MeshRealType, int >( parameters, parsedMeshType ); if( parsedMeshType[ 4 ] == "long int" ) - return resolveMeshType< MeshDimensions, MeshRealType, long int >( parameters, parsedMeshType ); + return resolveMeshType< MeshDimension, MeshRealType, long int >( parameters, parsedMeshType ); std::cerr << "The type '" << parsedMeshType[ 4 ] << "' is not allowed for indexing type." << std::endl; return false; } @@ -171,7 +171,7 @@ template< template< typename Real, typename Device, typename Index, typename Mes typename Device, typename Index, typename ConfigTag > - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename MeshIndexType, typename, typename > @@ -189,7 +189,7 @@ template< template< typename Real, typename Device, typename Index, typename Mes typename Device, typename Index, typename ConfigTag > - template< int MeshDimensions, + template< int MeshDimension, typename MeshRealType, typename MeshIndexType, typename > @@ -200,7 +200,7 @@ resolveMeshType( const Config::ParameterContainer& parameters, { if( parsedMeshType[ 0 ] == "Meshes::Grid" ) { - typedef Meshes::Grid< MeshDimensions, MeshRealType, Device, MeshIndexType > MeshType; + typedef Meshes::Grid< MeshDimension, MeshRealType, Device, MeshIndexType > MeshType; return MeshResolverTerminator< ProblemSetter, Real, Device, Index, MeshType, ConfigTag >::run( parameters ); } std::cerr << "Unknown mesh type " << parsedMeshType[ 0 ] << "." << std::endl; diff --git a/src/TNL/Solvers/PDE/CMakeLists.txt b/src/TNL/Solvers/PDE/CMakeLists.txt index 0f98d12a9f92b80279e810041ec9e4ba42f7bfaa..a9a9771a8d0ded43a6efe86396d7c915143db597 100755 --- a/src/TNL/Solvers/PDE/CMakeLists.txt +++ b/src/TNL/Solvers/PDE/CMakeLists.txt @@ -3,9 +3,7 @@ SET( headers BackwardTimeDiscretisation.h ExplicitTimeStepper.h ExplicitTimeStepper_impl.h ExplicitUpdater.h - ExplicitUpdater_impl.h LinearSystemAssembler.h - LinearSystemAssembler_impl.h NoTimeDiscretisation.h PDESolver.h PDESolver_impl.h diff --git a/src/TNL/Solvers/PDE/ExplicitUpdater.h b/src/TNL/Solvers/PDE/ExplicitUpdater.h index d06ac77ffb379a57382d44c97b5e7ca7868cbfe6..cc4056b70eeb082154dedbf2e2c6318a8949a77a 100644 --- a/src/TNL/Solvers/PDE/ExplicitUpdater.h +++ b/src/TNL/Solvers/PDE/ExplicitUpdater.h @@ -13,6 +13,12 @@ #include <TNL/Functions/FunctionAdapter.h> #include <TNL/Timer.h> #include <TNL/SharedPointer.h> +#include <type_traits> +#include <TNL/Meshes/GridDetails/Traverser_Grid1D.h> +#include <TNL/Meshes/GridDetails/Traverser_Grid2D.h> +#include <TNL/Meshes/GridDetails/Traverser_Grid3D.h> +#include <TNL/Solvers/PDE/ExplicitUpdater.h> + namespace TNL { namespace Solvers { @@ -47,7 +53,7 @@ class ExplicitUpdaterTraverserUserData {} - void setUserData( const Real& time, + /*void setUserData( const Real& time, const DifferentialOperator* differentialOperator, const BoundaryConditions* boundaryConditions, const RightHandSide* rightHandSide, @@ -60,7 +66,7 @@ class ExplicitUpdaterTraverserUserData this->rightHandSide = rightHandSide; this->u = u; this->fu = fu; - } + }*/ }; @@ -78,24 +84,67 @@ class ExplicitUpdater typedef typename MeshFunction::DeviceType DeviceType; typedef typename MeshFunction::IndexType IndexType; typedef ExplicitUpdaterTraverserUserData< RealType, - MeshFunction, - DifferentialOperator, - BoundaryConditions, - RightHandSide > TraverserUserData; + MeshFunction, + DifferentialOperator, + BoundaryConditions, + RightHandSide > TraverserUserData; typedef SharedPointer< DifferentialOperator, DeviceType > DifferentialOperatorPointer; typedef SharedPointer< BoundaryConditions, DeviceType > BoundaryConditionsPointer; typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer; typedef SharedPointer< MeshFunction, DeviceType > MeshFunctionPointer; typedef SharedPointer< TraverserUserData, DeviceType > TraverserUserDataPointer; + void setDifferentialOperator( const DifferentialOperatorPointer& differentialOperatorPointer ) + { + this->userDataPointer->differentialOperator = &differentialOperatorPointer.template getData< DeviceType >(); + } + + void setBoundaryConditions( const BoundaryConditionsPointer& boundaryConditionsPointer ) + { + this->userDataPointer->boundaryConditions = &boundaryConditionsPointer.template getData< DeviceType >(); + } + + void setRightHandSide( const RightHandSidePointer& rightHandSidePointer ) + { + this->userDataPointer->rightHandSide = &rightHandSidePointer.template getData< DeviceType >(); + } + template< typename EntityType > void update( const RealType& time, + const RealType& tau, const MeshPointer& meshPointer, - const DifferentialOperatorPointer& differentialOperatorPointer, - const BoundaryConditionsPointer& boundaryConditionsPointer, - const RightHandSidePointer& rightHandSidePointer, MeshFunctionPointer& uPointer, - MeshFunctionPointer& fuPointer ); + MeshFunctionPointer& fuPointer ) + { + static_assert( std::is_same< MeshFunction, + Containers::Vector< typename MeshFunction::RealType, + typename MeshFunction::DeviceType, + typename MeshFunction::IndexType > >::value != true, + "Error: I am getting Vector instead of MeshFunction or similar object. You might forget to bind DofVector into MeshFunction in you method getExplicitUpdate." ); + + TNL_ASSERT( this->userDataPointer->differentialOperator, + std::cerr << "The differential operator is not correctly set-up. Use method setDifferentialOperator() to do it." << std::endl ); + TNL_ASSERT( this->userDataPointer->boundaryConditions, + std::cerr << "The boundary conditions are not correctly set-up. Use method setBoundaryCondtions() to do it." << std::endl ); + TNL_ASSERT( this->userDataPointer->rightHandSide, + std::cerr << "The right-hand side is not correctly set-up. Use method setRightHandSide() to do it." << std::endl ); + + + this->userDataPointer->time = time; + this->userDataPointer->u = &uPointer.template modifyData< DeviceType >(); + this->userDataPointer->fu = &fuPointer.template modifyData< DeviceType >(); + Meshes::Traverser< MeshType, EntityType > meshTraverser; + meshTraverser.template processInteriorEntities< TraverserUserData, + TraverserInteriorEntitiesProcessor > + ( meshPointer, + userDataPointer ); + this->userDataPointer->time = time + tau; + meshTraverser.template processBoundaryEntities< TraverserUserData, + TraverserBoundaryEntitiesProcessor > + ( meshPointer, + userDataPointer ); + + } class TraverserBoundaryEntitiesProcessor @@ -118,7 +167,7 @@ class ExplicitUpdater { public: - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; template< typename EntityType > __cuda_callable__ @@ -145,5 +194,3 @@ class ExplicitUpdater } // namespace Solvers } // namespace TNL -#include <TNL/Solvers/PDE/ExplicitUpdater_impl.h> - diff --git a/src/TNL/Solvers/PDE/ExplicitUpdater_impl.h b/src/TNL/Solvers/PDE/ExplicitUpdater_impl.h deleted file mode 100644 index 72b044e5e619087f4566d02ab8ae698b875e46f3..0000000000000000000000000000000000000000 --- a/src/TNL/Solvers/PDE/ExplicitUpdater_impl.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - ExplicitUpdater_impl.h - description - ------------------- - begin : Jul 29, 2014 - copyright : (C) 2014 by Tomas Oberhuber - email : tomas.oberhuber@fjfi.cvut.cz - ***************************************************************************/ - -/* See Copyright Notice in tnl/Copyright */ - -#pragma once - -#include <type_traits> -#include <TNL/Meshes/GridDetails/Traverser_Grid1D.h> -#include <TNL/Meshes/GridDetails/Traverser_Grid2D.h> -#include <TNL/Meshes/GridDetails/Traverser_Grid3D.h> - -#include <TNL/Solvers/PDE/ExplicitUpdater.h> - - -namespace TNL { -namespace Solvers { -namespace PDE { - -template< typename Mesh, - typename MeshFunction, - typename DifferentialOperator, - typename BoundaryConditions, - typename RightHandSide > - template< typename EntityType > -void -ExplicitUpdater< Mesh, MeshFunction, DifferentialOperator, BoundaryConditions, RightHandSide >:: -update( const RealType& time, - const MeshPointer& meshPointer, - const DifferentialOperatorPointer& differentialOperatorPointer, - const BoundaryConditionsPointer& boundaryConditionsPointer, - const RightHandSidePointer& rightHandSidePointer, - MeshFunctionPointer& uPointer, - MeshFunctionPointer& fuPointer ) -{ - static_assert( std::is_same< MeshFunction, - Containers::Vector< typename MeshFunction::RealType, - typename MeshFunction::DeviceType, - typename MeshFunction::IndexType > >::value != true, - "Error: I am getting Vector instead of MeshFunction or similar object. You might forget to bind DofVector into MeshFunction in you method getExplicitUpdate." ); - { - //SharedPointer< TraverserUserData, DeviceType > - this->userDataPointer->setUserData( time, - &differentialOperatorPointer.template getData< DeviceType >(), - &boundaryConditionsPointer.template getData< DeviceType >(), - &rightHandSidePointer.template getData< DeviceType >(), - &uPointer.template modifyData< DeviceType >(), - &fuPointer.template modifyData< DeviceType >() ); - Meshes::Traverser< MeshType, EntityType > meshTraverser; - meshTraverser.template processBoundaryEntities< TraverserUserData, - TraverserBoundaryEntitiesProcessor > - ( meshPointer, - userDataPointer ); - meshTraverser.template processInteriorEntities< TraverserUserData, - TraverserInteriorEntitiesProcessor > - ( meshPointer, - userDataPointer ); - } -} - -} // namespace PDE -} // namespace Solvers -} // namespace TNL diff --git a/src/TNL/Solvers/PDE/LinearSystemAssembler.h b/src/TNL/Solvers/PDE/LinearSystemAssembler.h index 42efd0e346f9f3b7d185dc527e9cf743d29c5f0a..6b96f0b66cda28c970a38153e5ec637892746e88 100644 --- a/src/TNL/Solvers/PDE/LinearSystemAssembler.h +++ b/src/TNL/Solvers/PDE/LinearSystemAssembler.h @@ -22,7 +22,6 @@ template< typename Real, typename DifferentialOperator, typename BoundaryConditions, typename RightHandSide, - typename Matrix, typename DofVector > class LinearSystemAssemblerTraverserUserData { @@ -41,26 +40,18 @@ class LinearSystemAssemblerTraverserUserData DofVector* b = NULL; - Matrix* matrix = NULL; - - void setUserData( const Real& time, - const Real& tau, - const DifferentialOperator* differentialOperator, - const BoundaryConditions* boundaryConditions, - const RightHandSide* rightHandSide, - const MeshFunction* u, - Matrix* matrix, - DofVector* b ) - { - this->time = time; - this->tau = tau; - this->differentialOperator = differentialOperator; - this->boundaryConditions = boundaryConditions; - this->rightHandSide = rightHandSide; - this->u = u; - this->b = b; - this->matrix = matrix; - } + void* matrix = NULL; + + LinearSystemAssemblerTraverserUserData() + : time( 0.0 ), + tau( 0.0 ), + differentialOperator( NULL ), + boundaryConditions( NULL ), + rightHandSide( NULL ), + u( NULL ), + b( NULL ), + matrix( NULL ) + {} }; @@ -70,7 +61,6 @@ template< typename Mesh, typename BoundaryConditions, typename RightHandSide, typename TimeDiscretisation, - typename Matrix, typename DofVector > class LinearSystemAssembler { @@ -80,36 +70,70 @@ class LinearSystemAssembler typedef typename MeshFunction::RealType RealType; typedef typename MeshFunction::DeviceType DeviceType; typedef typename MeshFunction::IndexType IndexType; - typedef Matrix MatrixType; typedef LinearSystemAssemblerTraverserUserData< RealType, - MeshFunction, - DifferentialOperator, - BoundaryConditions, - RightHandSide, - MatrixType, - DofVector > TraverserUserData; - - typedef SharedPointer< Matrix, DeviceType > MatrixPointer; + MeshFunction, + DifferentialOperator, + BoundaryConditions, + RightHandSide, + DofVector > TraverserUserData; + + //typedef SharedPointer< Matrix, DeviceType > MatrixPointer; typedef SharedPointer< DifferentialOperator, DeviceType > DifferentialOperatorPointer; typedef SharedPointer< BoundaryConditions, DeviceType > BoundaryConditionsPointer; typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer; typedef SharedPointer< MeshFunction, DeviceType > MeshFunctionPointer; typedef SharedPointer< DofVector, DeviceType > DofVectorPointer; - - template< typename EntityType > + void setDifferentialOperator( const DifferentialOperatorPointer& differentialOperatorPointer ) + { + this->userDataPointer->differentialOperator = &differentialOperatorPointer.template getData< DeviceType >(); + } + + void setBoundaryConditions( const BoundaryConditionsPointer& boundaryConditionsPointer ) + { + this->userDataPointer->boundaryConditions = &boundaryConditionsPointer.template getData< DeviceType >(); + } + + void setRightHandSide( const RightHandSidePointer& rightHandSidePointer ) + { + this->userDataPointer->rightHandSide = &rightHandSidePointer.template getData< DeviceType >(); + } + + template< typename EntityType, typename Matrix > void assembly( const RealType& time, const RealType& tau, const MeshPointer& meshPointer, - const DifferentialOperatorPointer& differentialOperatorPointer, - const BoundaryConditionsPointer& boundaryConditionsPointer, - const RightHandSidePointer& rightHandSidePointer, const MeshFunctionPointer& uPointer, - MatrixPointer& matrixPointer, - DofVectorPointer& bPointer ); + SharedPointer< Matrix >& matrixPointer, + DofVectorPointer& bPointer ) + { + static_assert( std::is_same< MeshFunction, + Containers::Vector< typename MeshFunction::RealType, + typename MeshFunction::DeviceType, + typename MeshFunction::IndexType > >::value != true, + "Error: I am getting Vector instead of MeshFunction or similar object. You might forget to bind DofVector into MeshFunction in you method getExplicitUpdate." ); + + const IndexType maxRowLength = matrixPointer.template getData< Devices::Host >().getMaxRowLength(); + TNL_ASSERT( maxRowLength > 0, ); + this->userDataPointer->time = time; + this->userDataPointer->tau = tau; + this->userDataPointer->u = &uPointer.template getData< DeviceType >(); + this->userDataPointer->matrix = ( void* ) &matrixPointer.template modifyData< DeviceType >(); + this->userDataPointer->b = &bPointer.template modifyData< DeviceType >(); + Meshes::Traverser< MeshType, EntityType > meshTraverser; + meshTraverser.template processBoundaryEntities< TraverserUserData, + TraverserBoundaryEntitiesProcessor< Matrix> > + ( meshPointer, + userDataPointer ); + meshTraverser.template processInteriorEntities< TraverserUserData, + TraverserInteriorEntitiesProcessor< Matrix > > + ( meshPointer, + userDataPointer ); + + } - - class TraverserBoundaryEntitiesProcessor + template< typename Matrix > + class TraverserBoundaryEntitiesProcessor { public: @@ -125,11 +149,12 @@ class LinearSystemAssembler entity, userData.time + userData.tau, userData.tau, - ( *userData.matrix ), + ( * ( Matrix* ) ( userData.matrix ) ), ( *userData.b ) ); } }; + template< typename Matrix > class TraverserInteriorEntitiesProcessor { public: @@ -146,7 +171,7 @@ class LinearSystemAssembler entity, userData.time + userData.tau, userData.tau, - ( *userData.matrix ), + ( *( Matrix* )( userData.matrix ) ), ( *userData.b ) ); typedef Functions::FunctionAdapter< MeshType, RightHandSide > RhsFunctionAdapter; @@ -155,7 +180,7 @@ class LinearSystemAssembler ( ( *userData.rightHandSide ), entity, userData.time ); - TimeDiscretisation::applyTimeDiscretisation( ( *userData.matrix ), + TimeDiscretisation::applyTimeDiscretisation( ( *( Matrix* )( userData.matrix ) ), ( *userData.b )[ entity.getIndex() ], entity.getIndex(), MeshFunctionAdapter::getValue( ( *userData.u ), entity, userData.time ), @@ -171,5 +196,3 @@ protected: } // namespace PDE } // namespace Solvers } // namespace TNL - -#include <TNL/Solvers/PDE/LinearSystemAssembler_impl.h> diff --git a/src/TNL/Solvers/PDE/LinearSystemAssembler_impl.h b/src/TNL/Solvers/PDE/LinearSystemAssembler_impl.h deleted file mode 100644 index 6f3ce27918d9d36f7eead7bf16c50a59569e3c2b..0000000000000000000000000000000000000000 --- a/src/TNL/Solvers/PDE/LinearSystemAssembler_impl.h +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - LinearSystemAssembler_impl.h - description - ------------------- - begin : Oct 12, 2014 - copyright : (C) 2014 by Tomas Oberhuber - email : tomas.oberhuber@fjfi.cvut.cz - ***************************************************************************/ - -/* See Copyright Notice in tnl/Copyright */ - -#pragma once - -#include <type_traits> -#include <TNL/Meshes/GridDetails/Traverser_Grid1D.h> -#include <TNL/Meshes/GridDetails/Traverser_Grid2D.h> -#include <TNL/Meshes/GridDetails/Traverser_Grid3D.h> - -namespace TNL { -namespace Solvers { -namespace PDE { - -template< typename Mesh, - typename MeshFunction, - typename DifferentialOperator, - typename BoundaryConditions, - typename RightHandSide, - typename TimeDiscretisation, - typename Matrix, - typename DofVector > - template< typename EntityType > -void -LinearSystemAssembler< Mesh, MeshFunction, DifferentialOperator, BoundaryConditions, RightHandSide, TimeDiscretisation, Matrix, DofVector >:: -assembly( const RealType& time, - const RealType& tau, - const MeshPointer& meshPointer, - const DifferentialOperatorPointer& differentialOperatorPointer, - const BoundaryConditionsPointer& boundaryConditionsPointer, - const RightHandSidePointer& rightHandSidePointer, - const MeshFunctionPointer& uPointer, - MatrixPointer& matrixPointer, - DofVectorPointer& bPointer ) -{ - static_assert( std::is_same< MeshFunction, - Containers::Vector< typename MeshFunction::RealType, - typename MeshFunction::DeviceType, - typename MeshFunction::IndexType > >::value != true, - "Error: I am getting Vector instead of MeshFunction or similar object. You might forget to bind DofVector into MeshFunction in you method getExplicitUpdate." ); - - const IndexType maxRowLength = matrixPointer.template getData< Devices::Host >().getMaxRowLength(); - TNL_ASSERT( maxRowLength > 0, ); - - { - this->userDataPointer->setUserData( - time, - tau, - &differentialOperatorPointer.template getData< DeviceType >(), - &boundaryConditionsPointer.template getData< DeviceType >(), - &rightHandSidePointer.template getData< DeviceType >(), - &uPointer.template getData< DeviceType >(), - &matrixPointer.template modifyData< DeviceType >(), - &bPointer.template modifyData< DeviceType >() ); - Meshes::Traverser< MeshType, EntityType > meshTraverser; - meshTraverser.template processBoundaryEntities< TraverserUserData, - TraverserBoundaryEntitiesProcessor > - ( meshPointer, - userDataPointer ); - meshTraverser.template processInteriorEntities< TraverserUserData, - TraverserInteriorEntitiesProcessor > - ( meshPointer, - userDataPointer ); - } -} - -} // namespace PDE -} // namespace Solvers -} // namespace TNL diff --git a/src/TNL/legacy/mesh/tnlDistributedGrid.h b/src/TNL/legacy/mesh/tnlDistributedGrid.h index b6d0b718dff4924ab92e78484b13d1bd3083e3ec..6cdc286e9535c54e19a47e92cae58e286d6feaca 100644 --- a/src/TNL/legacy/mesh/tnlDistributedGrid.h +++ b/src/TNL/legacy/mesh/tnlDistributedGrid.h @@ -14,7 +14,7 @@ #include <TNL/Object.h> #include <TNL/tnlCommunicator.h> -template< int Dimensions, +template< int Dimension, typename GridType, typename Device = Devices::Host, typename Real = double, @@ -25,7 +25,7 @@ class tnlDistributedGrid : public Object tnlDistributedGrid(); //! We do not allow copy constructor without object name. - tnlDistributedGrid( const tnlDistributedGrid< Dimensions, Real, Device, Index >& a ); + tnlDistributedGrid( const tnlDistributedGrid< Dimension, Real, Device, Index >& a ); public: @@ -33,29 +33,29 @@ class tnlDistributedGrid : public Object bool init( tnlCommunicator* communicator, const GridType& grid, - const StaticVector< Dimensions, Index >& subdomainOverlaps ); + const StaticVector< Dimension, Index >& subdomainOverlaps ); tnlCommunicator< Device >* getCommunicator() const; - const StaticVector< Dimensions, Real >& getDomainLowerCorner() const; + const StaticVector< Dimension, Real >& getDomainLowerCorner() const; - const StaticVector< Dimensions, Real >& getDomainUpperCorner() const; + const StaticVector< Dimension, Real >& getDomainUpperCorner() const; - const StaticVector< Dimensions, Index >& getDimensions() const; + const StaticVector< Dimension, Index >& getDimensions() const; - const StaticVector< Dimensions, int >& getGridDimensions() const; + const StaticVector< Dimension, int >& getGridDimensions() const; - const StaticVector< Dimensions, int >& getLowerNeighbors() const; + const StaticVector< Dimension, int >& getLowerNeighbors() const; - const StaticVector< Dimensions, Index >& getLowerSubdomainsOverlaps() const; + const StaticVector< Dimension, Index >& getLowerSubdomainsOverlaps() const; - const StaticVector< Dimensions, int >& getNodeCoordinates() const; + const StaticVector< Dimension, int >& getNodeCoordinates() const; - const StaticVector< Dimensions, Index >& getSubdomainDimensions() const; + const StaticVector< Dimension, Index >& getSubdomainDimensions() const; - const StaticVector< Dimensions, Index >& getUpperSubdomainsOverlaps() const; + const StaticVector< Dimension, Index >& getUpperSubdomainsOverlaps() const; - const StaticVector< Dimensions, int >& getUppperNeighbors() const; + const StaticVector< Dimension, int >& getUppperNeighbors() const; protected: @@ -66,39 +66,39 @@ class tnlDistributedGrid : public Object /*!*** * This is naturally generalized to more dimensions. */ - StaticVector< Dimensions, Real > domainLowerCorner; + StaticVector< Dimension, Real > domainLowerCorner; //! In 2D this is the right top corner of the global domain. /*!*** * This is naturally generalized to more dimensions. */ - StaticVector< Dimensions, Real > domainUpperCorner; + StaticVector< Dimension, Real > domainUpperCorner; - //! Dimensions of the global domain. - StaticVector< Dimensions, Index > globalDimensions; + //! Dimension of the global domain. + StaticVector< Dimension, Index > globalDimensions; - //! Dimensions of the local subdomain. - StaticVector< Dimensions, Index > subdomainDimensions; + //! Dimension of the local subdomain. + StaticVector< Dimension, Index > subdomainDimensions; //! Number of the distributed grid nodes along each dimension. - StaticVector< Dimensions, int > gridDimensions; + StaticVector< Dimension, int > gridDimensions; //! Coordinates of this node of the distributed grid. - StaticVector< Dimensions, int > nodeCoordinates; + StaticVector< Dimension, int > nodeCoordinates; //! Here are device IDs taken from the tnlCommunicator. /*!*** * In 2D, this is the device ID of the neighbor on the * right and above. */ - StaticVector< Dimensions, int > uppperNeighbors; + StaticVector< Dimension, int > uppperNeighbors; //! Here are device IDs taken from the tnlCommunicator. /*!*** * In 2D, this is the device ID of the neighbor on the * left and below. */ - StaticVector< Dimensions, int > lowerNeighbors; + StaticVector< Dimension, int > lowerNeighbors; //! Here are widths of overlaps at subdomain boundaries with neighbors. /*!*** @@ -106,7 +106,7 @@ class tnlDistributedGrid : public Object * between neighboring nodes. In 2D, here are overlaps * with the neighbors on the right and above. */ - StaticVector< Dimensions, Index > upperSubdomainsOverlaps; + StaticVector< Dimension, Index > upperSubdomainsOverlaps; //! Here are widths of overlaps at subdomain boundaries with neighbors. /*!*** @@ -114,88 +114,88 @@ class tnlDistributedGrid : public Object * between neighboring nodes. In 2D, here are overlaps * with the neighbors on the left and below. */ - StaticVector< Dimensions, Index > lowerSubdomainsOverlaps; + StaticVector< Dimension, Index > lowerSubdomainsOverlaps; }; -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: tnlDistributedGrid( const String& name ) +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: tnlDistributedGrid( const String& name ) : Object( name ) { } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -bool tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: init( tnlCommunicator* communicator, +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +bool tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: init( tnlCommunicator* communicator, const GridType& grid, - const StaticVector< Dimensions, int >& gridDimensions, - const StaticVector< Dimensions, Index >& subdomainOverlaps ) + const StaticVector< Dimension, int >& gridDimensions, + const StaticVector< Dimension, Index >& subdomainOverlaps ) { } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -tnlCommunicator* tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getCommunicator() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +tnlCommunicator* tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getCommunicator() const { return communicator; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, Real >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getDomainLowerCorner() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, Real >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getDomainLowerCorner() const { return domainLowerCorner; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, Real >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getDomainUpperCorner() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, Real >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getDomainUpperCorner() const { return domainUpperCorner; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, Index >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getDimensions() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, Index >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getDimensions() const { return globalDimensions; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, int >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getGridDimensions() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, int >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getGridDimensions() const { return gridDimensions; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, int >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getLowerNeighbors() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, int >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getLowerNeighbors() const { return lowerNeighbors; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, Index >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getLowerSubdomainsOverlaps() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, Index >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getLowerSubdomainsOverlaps() const { return lowerSubdomainsOverlaps; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, int >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getNodeCoordinates() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, int >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getNodeCoordinates() const { return nodeCoordinates; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, Index >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getSubdomainDimensions() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, Index >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getSubdomainDimensions() const { return subdomainDimensions; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, Index >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getUpperSubdomainsOverlaps() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, Index >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getUpperSubdomainsOverlaps() const { return upperSubdomainsOverlaps; } -template< int Dimensions, typename GridType, typename Device, typename Real, typename Index > -const StaticVector< Dimensions, int >& tnlDistributedGrid< Dimensions, GridType, Device, Real, Index > :: getUppperNeighbors() const +template< int Dimension, typename GridType, typename Device, typename Real, typename Index > +const StaticVector< Dimension, int >& tnlDistributedGrid< Dimension, GridType, Device, Real, Index > :: getUppperNeighbors() const { return uppperNeighbors; } diff --git a/src/Tools/tnl-diff.h b/src/Tools/tnl-diff.h index 73036199d0dcb70c3d32ad1fcfae7d1f4e68318e..dc2ff7ca243198fa434b7badf0a8880f5cddf2db 100644 --- a/src/Tools/tnl-diff.h +++ b/src/Tools/tnl-diff.h @@ -50,7 +50,7 @@ bool computeDifferenceOfMeshFunctions( const MeshPointer& meshPointer, const Con std::cout << std::endl; typedef typename MeshPointer::ObjectType Mesh; - Functions::MeshFunction< Mesh, Mesh::getMeshDimensions(), Real > v1( meshPointer ), v2( meshPointer ), diff( meshPointer ); + Functions::MeshFunction< Mesh, Mesh::getMeshDimension(), Real > v1( meshPointer ), v2( meshPointer ), diff( meshPointer ); Real totalL1Diff( 0.0 ), totalL2Diff( 0.0 ), totalMaxDiff( 0.0 ); for( int i = 0; i < inputFiles. getSize(); i ++ ) { diff --git a/src/Tools/tnl-grid-setup.h b/src/Tools/tnl-grid-setup.h index b92db8a380f464287c656ff9e088d3768395eb68..d76133e4a1e3274cc1ec1fdd6dd92c5b86548f64 100644 --- a/src/Tools/tnl-grid-setup.h +++ b/src/Tools/tnl-grid-setup.h @@ -31,10 +31,10 @@ bool setupGrid( const Config::ParameterContainer& parameters ) std::cout << "Writing the grid to the file " << outputFile << " .... "; typedef Meshes::Grid< 1, RealType, Devices::Host, IndexType > GridType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; typedef typename GridType::CoordinatesType CoordinatesType; GridType grid; - grid.setDomain( VertexType( originX ), VertexType( proportionsX ) ); + grid.setDomain( PointType( originX ), PointType( proportionsX ) ); grid.setDimensions( CoordinatesType( sizeX ) ); if( ! grid.save( outputFile ) ) { @@ -54,10 +54,10 @@ bool setupGrid( const Config::ParameterContainer& parameters ) std::cout << "Writing the grid to the file " << outputFile << " .... "; typedef Meshes::Grid< 2, RealType, Devices::Host, IndexType > GridType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; typedef typename GridType::CoordinatesType CoordinatesType; GridType grid; - grid.setDomain( VertexType( originX, originY ), VertexType( proportionsX, proportionsY ) ); + grid.setDomain( PointType( originX, originY ), PointType( proportionsX, proportionsY ) ); grid.setDimensions( CoordinatesType( sizeX, sizeY ) ); if( ! grid.save( outputFile ) ) { @@ -80,10 +80,10 @@ bool setupGrid( const Config::ParameterContainer& parameters ) std::cout << "Writing the grid to the file " << outputFile << " .... "; typedef Meshes::Grid< 3, RealType, Devices::Host, IndexType > GridType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; typedef typename GridType::CoordinatesType CoordinatesType; GridType grid; - grid.setDomain( VertexType( originX, originY, originZ ), VertexType( proportionsX, proportionsY, proportionsZ ) ); + grid.setDomain( PointType( originX, originY, originZ ), PointType( proportionsX, proportionsY, proportionsZ ) ); grid.setDimensions( CoordinatesType( sizeX, sizeY, sizeZ ) ); if( ! grid.save( outputFile ) ) { diff --git a/src/Tools/tnl-init.h b/src/Tools/tnl-init.h index 98f0e461751a955f73a92bee419f29917bc7b3a5..182f51b28536b06ac86d5e76c3d997e01367c83a 100644 --- a/src/Tools/tnl-init.h +++ b/src/Tools/tnl-init.h @@ -34,14 +34,14 @@ bool renderFunction( const Config::ParameterContainer& parameters ) if( ! meshPointer->load( meshFile ) ) return false; - typedef Functions::TestFunction< MeshType::meshDimensions, RealType > FunctionType; + typedef Functions::TestFunction< MeshType::meshDimension, RealType > FunctionType; typedef SharedPointer< FunctionType, typename MeshType::DeviceType > FunctionPointer; FunctionPointer function; std::cout << "Setting up the function ... " << std::endl; if( ! function->setup( parameters, "" ) ) return false; std::cout << "done." << std::endl; - typedef Functions::MeshFunction< MeshType, MeshType::meshDimensions > MeshFunctionType; + typedef Functions::MeshFunction< MeshType, MeshType::meshDimension > MeshFunctionType; typedef SharedPointer< MeshFunctionType, typename MeshType::DeviceType > MeshFunctionPointer; MeshFunctionPointer meshFunction( meshPointer ); //if( ! discreteFunction.setSize( mesh.template getEntitiesCount< typename MeshType::Cell >() ) ) @@ -200,7 +200,7 @@ bool resolveRealType( const Config::ParameterContainer& parameters ) } -template< int Dimensions, typename RealType, typename IndexType > +template< int Dimension, typename RealType, typename IndexType > bool resolveMesh( const Containers::List< String >& parsedMeshType, const Config::ParameterContainer& parameters ) { @@ -208,40 +208,40 @@ bool resolveMesh( const Containers::List< String >& parsedMeshType, if( parsedMeshType[ 0 ] == "Meshes::Grid" || parsedMeshType[ 0 ] == "tnlGrid" ) // TODO: remove deprecated type name { - typedef Meshes::Grid< Dimensions, RealType, Devices::Host, IndexType > MeshType; + typedef Meshes::Grid< Dimension, RealType, Devices::Host, IndexType > MeshType; return resolveRealType< MeshType >( parameters ); } std::cerr << "Unknown mesh type." << std::endl; return false; } -template< int Dimensions, typename RealType > +template< int Dimension, typename RealType > bool resolveIndexType( const Containers::List< String >& parsedMeshType, const Config::ParameterContainer& parameters ) { std::cout << "+ -> Setting index type to " << parsedMeshType[ 4 ] << " ... " << std::endl; if( parsedMeshType[ 4 ] == "int" ) - return resolveMesh< Dimensions, RealType, int >( parsedMeshType, parameters ); + return resolveMesh< Dimension, RealType, int >( parsedMeshType, parameters ); if( parsedMeshType[ 4 ] == "long int" ) - return resolveMesh< Dimensions, RealType, long int >( parsedMeshType, parameters ); + return resolveMesh< Dimension, RealType, long int >( parsedMeshType, parameters ); return false; } -template< int Dimensions > +template< int Dimension > bool resolveRealType( const Containers::List< String >& parsedMeshType, const Config::ParameterContainer& parameters ) { std::cout << "+ -> Setting real type to " << parsedMeshType[ 2 ] << " ... " << std::endl; if( parsedMeshType[ 2 ] == "float" ) - return resolveIndexType< Dimensions, float >( parsedMeshType, parameters ); + return resolveIndexType< Dimension, float >( parsedMeshType, parameters ); if( parsedMeshType[ 2 ] == "double" ) - return resolveIndexType< Dimensions, double >( parsedMeshType, parameters ); + return resolveIndexType< Dimension, double >( parsedMeshType, parameters ); if( parsedMeshType[ 2 ] == "long-double" ) - return resolveIndexType< Dimensions, long double >( parsedMeshType, parameters ); + return resolveIndexType< Dimension, long double >( parsedMeshType, parameters ); return false; } diff --git a/src/Tools/tnl-mesh-convert.h b/src/Tools/tnl-mesh-convert.h index 320258f934fc3cc0f9a5464aba1284d651dd0e0b..a45e8d0e4b11d14cf5ad7af0a82404b2f6f01162 100644 --- a/src/Tools/tnl-mesh-convert.h +++ b/src/Tools/tnl-mesh-convert.h @@ -73,9 +73,9 @@ bool readNetgenMesh( const Config::ParameterContainer& parameters ) if( ! meshReader.detectMesh( inputFileName ) ) return false; - std::cout << "Reading mesh with " << meshReader.getDimensions() << " dimensions..." << std::endl; + std::cout << "Reading mesh with " << meshReader.getDimension() << " dimensions..." << std::endl; - if( meshReader.getDimensions() == 2 ) + if( meshReader.getDimension() == 2 ) { if( meshReader.getVerticesInCell() == 3 ) { @@ -90,7 +90,7 @@ bool readNetgenMesh( const Config::ParameterContainer& parameters ) return convertMesh< MeshReaderNetgen, MeshType >( parameters ); } } - if( meshReader.getDimensions() == 3 ) + if( meshReader.getDimension() == 3 ) { if( meshReader.getVerticesInCell() == 4 ) { @@ -105,7 +105,7 @@ bool readNetgenMesh( const Config::ParameterContainer& parameters ) return convertMesh< MeshReaderNetgen, MeshType >( parameters ); } } - std::cerr << "Wrong mesh dimensions were detected ( " << meshReader.getDimensions() << " )." << std::endl; + std::cerr << "Wrong mesh dimensions were detected ( " << meshReader.getDimension() << " )." << std::endl; return false; } diff --git a/src/Tools/tnl-quickstart/Makefile.in b/src/Tools/tnl-quickstart/Makefile.in index 48f3908b58d9888aa6cda6959ba65c96745793c7..c2954e00e8f855f14bd52eda44fc77f95c8a9416 100644 --- a/src/Tools/tnl-quickstart/Makefile.in +++ b/src/Tools/tnl-quickstart/Makefile.in @@ -1,6 +1,3 @@ -# Uncomment the following line to enable CUDA -#WITH_CUDA = yes - TARGET = {problemBaseName} INSTALL_DIR = ${{HOME}}/local @@ -16,11 +13,12 @@ endif SOURCES = {problemBaseName}.cpp HEADERS = {problemBaseName}.h -OBJECTS = {problemBaseName}.o DIST = $(SOURCES) $(CUDA_SOURCES) $(HEADERS) Makefile ifdef WITH_CUDA OBJECTS = {problemBaseName}-cuda.o +else + OBJECTS = {problemBaseName}.o endif all: $(TARGET) diff --git a/src/Tools/tnl-quickstart/build-config-tag.h.in b/src/Tools/tnl-quickstart/build-config-tag.h.in index b965a6db1c0a8a4a01dafb2a4c77bf211e8bb298..c72d8c1b9dd30c104ff3530cef8c715c04a0e7ee 100644 --- a/src/Tools/tnl-quickstart/build-config-tag.h.in +++ b/src/Tools/tnl-quickstart/build-config-tag.h.in @@ -22,14 +22,14 @@ template<> struct ConfigTagIndex< {problemBaseName}BuildConfigTag, long int >{{ /**** * With how many dimensions may have the problem to be solved... */ -template< int Dimensions > struct ConfigTagDimensions< {problemBaseName}BuildConfigTag, Dimensions >{{ enum {{ enabled = ( Dimensions == 1 ) }}; }}; +template< int Dimension > struct ConfigTagDimension< {problemBaseName}BuildConfigTag, Dimension >{{ enum {{ enabled = ( Dimension == 1 ) }}; }}; /**** * Use of Meshes::Grid is enabled for allowed dimensions and Real, Device and Index types. */ -template< int Dimensions, typename Real, typename Device, typename Index > - struct ConfigTagMesh< {problemBaseName}BuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > > - {{ enum {{ enabled = ConfigTagDimensions< {problemBaseName}BuildConfigTag, Dimensions >::enabled && +template< int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< {problemBaseName}BuildConfigTag, Meshes::Grid< Dimension, Real, Device, Index > > + {{ enum {{ enabled = ConfigTagDimension< {problemBaseName}BuildConfigTag, Dimension >::enabled && ConfigTagReal< {problemBaseName}BuildConfigTag, Real >::enabled && ConfigTagDevice< {problemBaseName}BuildConfigTag, Device >::enabled && ConfigTagIndex< {problemBaseName}BuildConfigTag, Index >::enabled }}; }}; diff --git a/src/Tools/tnl-quickstart/explicit-laplace-grid-1d_impl.h.in b/src/Tools/tnl-quickstart/explicit-laplace-grid-1d_impl.h.in index d952cb637c3ca0afdedd577a7b6341d65c8e211e..1e1eaa44a175c7688f1b6864e9f7e5ffaea1fa5e 100644 --- a/src/Tools/tnl-quickstart/explicit-laplace-grid-1d_impl.h.in +++ b/src/Tools/tnl-quickstart/explicit-laplace-grid-1d_impl.h.in @@ -1,5 +1,5 @@ const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; \ No newline at end of file diff --git a/src/Tools/tnl-quickstart/explicit-laplace-grid-2d_impl.h.in b/src/Tools/tnl-quickstart/explicit-laplace-grid-2d_impl.h.in index ad817b3b31fc422759a76d4093336e67dee6a6dc..8c3b7d796ce12d8bb96fda55e47d55568bd8d5bd 100644 --- a/src/Tools/tnl-quickstart/explicit-laplace-grid-2d_impl.h.in +++ b/src/Tools/tnl-quickstart/explicit-laplace-grid-2d_impl.h.in @@ -1,9 +1,9 @@ const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse; \ No newline at end of file diff --git a/src/Tools/tnl-quickstart/explicit-laplace-grid-3d_impl.h.in b/src/Tools/tnl-quickstart/explicit-laplace-grid-3d_impl.h.in index 7b2f234c2037ee8de516d2d04a0877e307e64e12..aa6ff5f3f7fcc731c57667cc3e12c52ca0087218 100644 --- a/src/Tools/tnl-quickstart/explicit-laplace-grid-3d_impl.h.in +++ b/src/Tools/tnl-quickstart/explicit-laplace-grid-3d_impl.h.in @@ -2,12 +2,12 @@ const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; \ No newline at end of file diff --git a/src/Tools/tnl-quickstart/implicit-laplace-grid-1d_impl.h.in b/src/Tools/tnl-quickstart/implicit-laplace-grid-1d_impl.h.in index de086c72e305d76b2130e0a2e09da73f68c40fd1..e5a139e22c202672510f59b607c5d099d2772c4e 100644 --- a/src/Tools/tnl-quickstart/implicit-laplace-grid-1d_impl.h.in +++ b/src/Tools/tnl-quickstart/implicit-laplace-grid-1d_impl.h.in @@ -1,7 +1,7 @@ const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); \ No newline at end of file diff --git a/src/Tools/tnl-quickstart/implicit-laplace-grid-2d_impl.h.in b/src/Tools/tnl-quickstart/implicit-laplace-grid-2d_impl.h.in index 048949469ddff7d49bbd7ca82e74ff322fa789cd..808d829a88028d9e75c6a6bbaa1b092d3ce4d361 100644 --- a/src/Tools/tnl-quickstart/implicit-laplace-grid-2d_impl.h.in +++ b/src/Tools/tnl-quickstart/implicit-laplace-grid-2d_impl.h.in @@ -1,10 +1,10 @@ const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); diff --git a/src/Tools/tnl-quickstart/implicit-laplace-grid-3d_impl.h.in b/src/Tools/tnl-quickstart/implicit-laplace-grid-3d_impl.h.in index 2343334c4044143815dc5ebfad19fc2c26e767c3..7bbec43866834f69db96e250aaaec9af8c717586 100644 --- a/src/Tools/tnl-quickstart/implicit-laplace-grid-3d_impl.h.in +++ b/src/Tools/tnl-quickstart/implicit-laplace-grid-3d_impl.h.in @@ -2,12 +2,12 @@ const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/src/Tools/tnl-quickstart/main.h.in b/src/Tools/tnl-quickstart/main.h.in index 4fd410563132bbc17a77a0d359aad58961fda339..f836967c83ccc88fed8898a0c344a9ea08e40906 100644 --- a/src/Tools/tnl-quickstart/main.h.in +++ b/src/Tools/tnl-quickstart/main.h.in @@ -58,10 +58,10 @@ class {problemBaseName}Setter static bool run( const Config::ParameterContainer & parameters ) {{ - enum {{ Dimensions = MeshType::getMeshDimensions() }}; + enum {{ Dimension = MeshType::getMeshDimension() }}; typedef {operatorName}< MeshType, Real, Index > ApproximateOperator; typedef {problemBaseName}Rhs< MeshType, Real > RightHandSide; - typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex; + typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Vertex; /**** * Resolve the template arguments of your solver here. @@ -71,10 +71,10 @@ class {problemBaseName}Setter String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) {{ - typedef Functions::Analytic::Constant< Dimensions, Real > ConstantFunction; + typedef Functions::Analytic::Constant< Dimension, Real > ConstantFunction; if( boundaryConditionsType == "dirichlet" ) {{ - typedef Operators::DirichletBoundaryConditions< MeshType, ConstantFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, ConstantFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef {problemBaseName}Problem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); @@ -86,8 +86,8 @@ class {problemBaseName}Setter }} typedef Functions::MeshFunction< MeshType > MeshFunction; if( boundaryConditionsType == "dirichlet" ) - {{ - typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + {{ + typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef {problemBaseName}Problem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); diff --git a/src/Tools/tnl-quickstart/operator-grid-specialization.h.in b/src/Tools/tnl-quickstart/operator-grid-specialization.h.in index de06efc27e04caa98c02521abd936c88c7a7c259..e67c5e007a02f45bce36eb079ae529c27f7dce0f 100644 --- a/src/Tools/tnl-quickstart/operator-grid-specialization.h.in +++ b/src/Tools/tnl-quickstart/operator-grid-specialization.h.in @@ -3,16 +3,16 @@ template< typename MeshReal, typename MeshIndex, typename Real, typename Index > -class {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index > +class {operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index > {{ public: - typedef TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex > MeshType; + typedef TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex > MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; typedef TNL::Functions::MeshFunction< MeshType > MeshFunctionType; - enum {{ Dimensions = MeshType::getMeshDimensions() }}; + enum {{ Dimension = MeshType::getMeshDimension() }}; static TNL::String getType(); @@ -22,8 +22,8 @@ class {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, Mes const MeshEntity& entity, const RealType& time = 0.0 ) const; - __cuda_callable__ template< typename MeshEntity > + __cuda_callable__ Index getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const; diff --git a/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in b/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in index cf73e55f5805a133a269b6a856ecf5be04804af1..3e7d0d670f5de48659c146bbf7b1fb62287e4a38 100644 --- a/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in +++ b/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in @@ -1,5 +1,5 @@ /**** - * {meshDimensions}D problem + * {meshDimension}D problem */ template< typename MeshReal, typename Device, @@ -7,7 +7,7 @@ template< typename MeshReal, typename Real, typename Index > TNL::String -{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >:: getType() {{ return TNL::String( "{operatorName}< " ) + @@ -24,7 +24,7 @@ template< typename MeshReal, template< typename MeshFunction, typename MeshEntity > __cuda_callable__ Real -{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >:: operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time ) const @@ -34,9 +34,9 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == {meshDimensions}, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == {meshDimensions}, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< {meshDimensions} >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == {meshDimension}, "Wrong mesh entity dimensions." ); + static_assert( MeshFunction::getEntitiesDimension() == {meshDimension}, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< {meshDimension} >& neighborEntities = entity.getNeighborEntities(); {explicitScheme} }} @@ -49,7 +49,7 @@ template< typename MeshReal, template< typename MeshEntity > __cuda_callable__ Index -{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >:: getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const @@ -61,7 +61,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; }} template< typename MeshReal, @@ -76,7 +76,7 @@ template< typename MeshReal, __cuda_callable__ inline void -{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >:: setMatrixElements( const PreimageFunction& u, const MeshEntity& entity, const RealType& time, @@ -84,15 +84,15 @@ setMatrixElements( const PreimageFunction& u, Matrix& matrix, Vector& b ) const {{ - static_assert( MeshEntity::entityDimensions == {meshDimensions}, "Wrong mesh entity dimensions." ); - static_assert( PreimageFunction::getEntitiesDimensions() == {meshDimensions}, "Wrong preimage function" ); + static_assert( MeshEntity::entityDimension == {meshDimension}, "Wrong mesh entity dimensions." ); + static_assert( PreimageFunction::getEntitiesDimension() == {meshDimension}, "Wrong preimage function" ); /**** * Setup the non-zero elements of the linear system here. * The following example is the Laplace operator approximated * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< {meshDimensions} >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< {meshDimension} >& neighborEntities = entity.getNeighborEntities(); const IndexType& index = entity.getIndex(); typename Matrix::MatrixRow matrixRow = matrix.getRow( index ); {semiimplicitScheme} diff --git a/src/Tools/tnl-quickstart/problem.h.in b/src/Tools/tnl-quickstart/problem.h.in index 32fcf2f07a2e020b3b25a3761561e4849f9bca50..dd53ffe43f77e58a5dd49cdc51306820a0b07249 100644 --- a/src/Tools/tnl-quickstart/problem.h.in +++ b/src/Tools/tnl-quickstart/problem.h.in @@ -2,6 +2,10 @@ #include <TNL/Problems/PDEProblem.h> #include <TNL/Functions/MeshFunction.h> +#include <TNL/Solvers/PDE/ExplicitUpdater.h> +#include <TNL/Solvers/PDE/LinearSystemAssembler.h> +#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h> + template< typename Mesh, typename BoundaryCondition, @@ -85,6 +89,16 @@ class {problemBaseName}Problem: DifferentialOperatorPointer differentialOperator; BoundaryConditionPointer boundaryCondition; RightHandSidePointer rightHandSide; + + TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; + + TNL::Solvers::PDE::LinearSystemAssembler< Mesh, + MeshFunctionType, + DifferentialOperator, + BoundaryCondition, + RightHandSide, + TNL::Solvers::PDE::BackwardTimeDiscretisation, + DofVectorType > systemAssembler; }}; #include "{problemBaseName}Problem_impl.h" diff --git a/src/Tools/tnl-quickstart/problem_impl.h.in b/src/Tools/tnl-quickstart/problem_impl.h.in index 18ba3a287ab6d6df79a3d3d594aa8a12147f8c0a..d0b1162383eea26cf35282ecb78b9b5143f4abdb 100644 --- a/src/Tools/tnl-quickstart/problem_impl.h.in +++ b/src/Tools/tnl-quickstart/problem_impl.h.in @@ -117,17 +117,17 @@ setupLinearSystem( const MeshPointer& meshPointer, MatrixPointer& matrixPointer ) {{ const IndexType dofs = this->getDofs( meshPointer ); - typedef typename MatrixPointer::ObjectType::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; - TNL::SharedPointer< CompressedRowsLengthsVectorType > rowLengthsPointer; + typedef typename MatrixPointer::ObjectType::CompressedRowLengthsVector CompressedRowLengthsVectorType; + TNL::SharedPointer< CompressedRowLengthsVectorType > rowLengthsPointer; if( ! rowLengthsPointer->setSize( dofs ) ) return false; - TNL::Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; - matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( meshPointer, - differentialOperator, - boundaryCondition, - rowLengthsPointer ); + TNL::Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter; + matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( meshPointer, + differentialOperator, + boundaryCondition, + rowLengthsPointer ); matrixPointer->setDimensions( dofs, dofs ); - if( ! matrixPointer->setCompressedRowsLengths( *rowLengthsPointer ) ) + if( ! matrixPointer->setCompressedRowLengths( *rowLengthsPointer ) ) return false; return true; }} @@ -177,22 +177,12 @@ getExplicitUpdate( const RealType& time, * You may use supporting mesh dependent data if you need. */ - this->bindDofs( mesh, _u ); - TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; - TNL::SharedPointer< MeshFunctionType > u( mesh, _u ); - TNL::SharedPointer< MeshFunctionType > fu( mesh, _fu ); - explicitUpdater.template update< typename Mesh::Cell >( time, - mesh, - this->differentialOperator, - this->boundaryCondition, - this->rightHandSide, - u, - fu ); - TNL::Solvers::PDE::BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; - boundaryConditionsSetter.template apply< typename Mesh::Cell >( - this->boundaryCondition, - time + tau, - u ); + TNL::SharedPointer< MeshFunctionType > uPointer( mesh, _u ); + TNL::SharedPointer< MeshFunctionType > fuPointer( mesh, _fu ); + this->explicitUpdater.setDifferentialOperator( this->differentialOperator ), + this->explicitUpdater.setBoundaryConditions( this->boundaryCondition ), + this->explicitUpdater.setRightHandSide( this->rightHandSide ), + this->explicitUpdater.template update< typename Mesh::Cell >( time, tau, mesh, uPointer, fuPointer ); }} template< typename Mesh, @@ -210,23 +200,21 @@ assemblyLinearSystem( const RealType& time, DofVectorPointer& b, MeshDependentDataPointer& meshDependentData ) {{ - TNL::Solvers::PDE::LinearSystemAssembler< Mesh, - MeshFunctionType, - DifferentialOperator, - BoundaryCondition, - RightHandSide, - TNL::Solvers::PDE::BackwardTimeDiscretisation, - typename MatrixPointer::ObjectType, - DofVectorType > systemAssembler; + /**** + * If you implement a (semi-)implicit solver, this method is supposed + * to assembly the global linear system in each time step. + * You may use supporting mesh dependent data if you need. + */ - TNL::SharedPointer< TNL::Functions::MeshFunction< Mesh > > u( mesh, _u ); - systemAssembler.template assembly< typename Mesh::Cell >( time, - tau, - mesh, - this->differentialOperator, - this->boundaryCondition, - this->rightHandSide, - u, - matrixPointer, - b ); + TNL::SharedPointer< TNL::Functions::MeshFunction< Mesh > > uPointer( mesh, _u ); + this->systemAssembler.setDifferentialOperator( this->differentialOperator ); + this->systemAssembler.setBoundaryConditions( this->boundaryCondition ); + this->systemAssembler.setRightHandSide( this->rightHandSide ); + this->systemAssembler.template assembly< typename Mesh::Cell, typename MatrixPointer::ObjectType >( + time, + tau, + mesh, + uPointer, + matrixPointer, + b ); }} diff --git a/src/Tools/tnl-quickstart/rhs.h.in b/src/Tools/tnl-quickstart/rhs.h.in index 71f3d1e79eebc705c73e9e0b522a5ae93e0a0ce5..ffd1b78813dbfcd2f17809fcea69f2d999e86b89 100644 --- a/src/Tools/tnl-quickstart/rhs.h.in +++ b/src/Tools/tnl-quickstart/rhs.h.in @@ -4,7 +4,7 @@ template< typename Mesh, typename Real > class {problemBaseName}Rhs - : public TNL::Functions::Domain< Mesh::meshDimensions, TNL::Functions::MeshDomain > + : public TNL::Functions::Domain< Mesh::meshDimension, TNL::Functions::MeshDomain > {{ public: @@ -22,8 +22,8 @@ class {problemBaseName}Rhs Real operator()( const MeshEntity& entity, const Real& time = 0.0 ) const {{ - typedef typename MeshEntity::MeshType::VertexType VertexType; - VertexType v = entity.getCenter(); + typedef typename MeshEntity::MeshType::PointType PointType; + PointType p = entity.getCenter(); return 0.0; }} }}; \ No newline at end of file diff --git a/src/Tools/tnl-quickstart/tnl-quickstart.py b/src/Tools/tnl-quickstart/tnl-quickstart.py index 4242a2c085fae5d83cc5747632035439d7fbd5d7..f456952696ad52d06fb7e3806e885dbc62d33be1 100644 --- a/src/Tools/tnl-quickstart/tnl-quickstart.py +++ b/src/Tools/tnl-quickstart/tnl-quickstart.py @@ -18,7 +18,7 @@ print( "----------------------------------") definitions = {} -definitions['problemName'] = input( "Problam name:" ) +definitions['problemName'] = input( "Problem name:" ) definitions['problemBaseName'] = input( "Problem class base name (base name acceptable in C++ code):" ) definitions['operatorName'] = input( "Operator name:") @@ -40,7 +40,7 @@ with open( definitions['problemBaseName']+".h", 'w') as file: with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/main.cu.in", 'r') as ftemp: templateString = ftemp.read() -with open( definitions['problemBaseName']+".cu", 'w') as file: +with open( definitions['problemBaseName']+"-cuda.cu", 'w') as file: file.write( templateString.format(**definitions ) ) with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/main.cpp.in", 'r') as ftemp: @@ -65,19 +65,19 @@ with open( definitions['problemBaseName'] + "Problem_impl.h", 'w') as file: # Operator # dimensions = [ '1', '2', '3' ] -for meshDimensions in dimensions: - definitions[ 'meshDimensions' ] = meshDimensions - key = 'operatorGridSpecializationHeader_' + meshDimensions + 'D' +for meshDimension in dimensions: + definitions[ 'meshDimension' ] = meshDimension + key = 'operatorGridSpecializationHeader_' + meshDimension + 'D' with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/operator-grid-specialization.h.in", 'r') as ftemp: templateString = ftemp.read() definitions[ key ] = templateString.format( **definitions ) - with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/explicit-laplace-grid-" + meshDimensions + "d_impl.h.in", 'r') as ftemp: + with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/explicit-laplace-grid-" + meshDimension + "d_impl.h.in", 'r') as ftemp: definitions[ 'explicitScheme' ] = ftemp.read(); - with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/implicit-laplace-grid-" + meshDimensions + "d_impl.h.in", 'r') as ftemp: + with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/implicit-laplace-grid-" + meshDimension + "d_impl.h.in", 'r') as ftemp: definitions[ 'semiimplicitScheme' ] = ftemp.read(); - key = 'operatorGridSpecializationImplementation_' + meshDimensions + 'D' + key = 'operatorGridSpecializationImplementation_' + meshDimension + 'D' with open( TNL.Config.tnl_install_prefix+"/share/tnl-" + TNL.Config.tnl_version + "/operator-grid-specialization_impl.h.in", 'r') as ftemp: templateString = ftemp.read() definitions[ key ] = templateString.format( **definitions ) diff --git a/src/Tools/tnl-view.h b/src/Tools/tnl-view.h index 60c366c4aa581f4cb107d12b1357aef61e966440..a0594fc8a384bab44f1572a9511fc9735d569213 100644 --- a/src/Tools/tnl-view.h +++ b/src/Tools/tnl-view.h @@ -70,43 +70,43 @@ bool writeMeshFunction( const typename MeshFunction::MeshPointer& meshPointer, } template< typename MeshPointer, - int EntityDimensions, + int EntityDimension, typename Real > bool setMeshFunctionRealType( const MeshPointer& meshPointer, const String& inputFileName, const Config::ParameterContainer& parameters ) { - return writeMeshFunction< Functions::MeshFunction< typename MeshPointer::ObjectType, EntityDimensions, Real > >( meshPointer, inputFileName, parameters ); + return writeMeshFunction< Functions::MeshFunction< typename MeshPointer::ObjectType, EntityDimension, Real > >( meshPointer, inputFileName, parameters ); } template< typename MeshPointer, - int EntityDimensions > + int EntityDimension > bool setMeshEntityType( const MeshPointer& meshPointer, const String& inputFileName, const Containers::List< String >& parsedObjectType, const Config::ParameterContainer& parameters ) { if( parsedObjectType[ 3 ] == "float" ) - return setMeshFunctionRealType< MeshPointer, EntityDimensions, float >( meshPointer, inputFileName, parameters ); + return setMeshFunctionRealType< MeshPointer, EntityDimension, float >( meshPointer, inputFileName, parameters ); if( parsedObjectType[ 3 ] == "double" ) - return setMeshFunctionRealType< MeshPointer, EntityDimensions, double >( meshPointer, inputFileName, parameters ); + return setMeshFunctionRealType< MeshPointer, EntityDimension, double >( meshPointer, inputFileName, parameters ); if( parsedObjectType[ 3 ] == "long double" ) - return setMeshFunctionRealType< MeshPointer, EntityDimensions, long double >( meshPointer, inputFileName, parameters ); + return setMeshFunctionRealType< MeshPointer, EntityDimension, long double >( meshPointer, inputFileName, parameters ); std::cerr << "Unsupported arithmetics " << parsedObjectType[ 3 ] << " in mesh function " << inputFileName << std::endl; return false; } template< typename MeshReal, typename MeshIndex > -bool setMeshEntityDimensions( const SharedPointer< Meshes::Grid< 1, MeshReal, Devices::Host, MeshIndex > >& meshPointer, +bool setMeshEntityDimension( const SharedPointer< Meshes::Grid< 1, MeshReal, Devices::Host, MeshIndex > >& meshPointer, const String& inputFileName, const Containers::List< String >& parsedObjectType, const Config::ParameterContainer& parameters ) { typedef Meshes::Grid< 1, MeshReal, Devices::Host, MeshIndex > Mesh; typedef SharedPointer< Mesh > MeshPointer; - int meshEntityDimensions = atoi( parsedObjectType[ 2 ].getString() ); - switch( meshEntityDimensions ) + int meshEntityDimension = atoi( parsedObjectType[ 2 ].getString() ); + switch( meshEntityDimension ) { case 0: return setMeshEntityType< MeshPointer, 0 >( meshPointer, inputFileName, parsedObjectType, parameters ); @@ -115,22 +115,22 @@ bool setMeshEntityDimensions( const SharedPointer< Meshes::Grid< 1, MeshReal, De return setMeshEntityType< MeshPointer, 1 >( meshPointer, inputFileName, parsedObjectType, parameters ); break; default: - std::cerr << "Unsupported mesh functions entity dimensions count " << meshEntityDimensions << "." << std::endl; + std::cerr << "Unsupported mesh functions entity dimension count " << meshEntityDimension << "." << std::endl; return false; } } template< typename MeshReal, typename MeshIndex > -bool setMeshEntityDimensions( const SharedPointer< Meshes::Grid< 2, MeshReal, Devices::Host, MeshIndex > >& meshPointer, +bool setMeshEntityDimension( const SharedPointer< Meshes::Grid< 2, MeshReal, Devices::Host, MeshIndex > >& meshPointer, const String& inputFileName, const Containers::List< String >& parsedObjectType, const Config::ParameterContainer& parameters ) { typedef Meshes::Grid< 2, MeshReal, Devices::Host, MeshIndex > Mesh; typedef SharedPointer< Mesh > MeshPointer; - int meshEntityDimensions = atoi( parsedObjectType[ 2 ].getString() ); - switch( meshEntityDimensions ) + int meshEntityDimension = atoi( parsedObjectType[ 2 ].getString() ); + switch( meshEntityDimension ) { case 0: return setMeshEntityType< MeshPointer, 0 >( meshPointer, inputFileName, parsedObjectType, parameters ); @@ -142,22 +142,22 @@ bool setMeshEntityDimensions( const SharedPointer< Meshes::Grid< 2, MeshReal, De return setMeshEntityType< MeshPointer, 2 >( meshPointer, inputFileName, parsedObjectType, parameters ); break; default: - std::cerr << "Unsupported mesh functions entity dimensions count " << meshEntityDimensions << "." << std::endl; + std::cerr << "Unsupported mesh functions entity dimension count " << meshEntityDimension << "." << std::endl; return false; } } template< typename MeshReal, typename MeshIndex > -bool setMeshEntityDimensions( const SharedPointer< Meshes::Grid< 3, MeshReal, Devices::Host, MeshIndex > >& meshPointer, +bool setMeshEntityDimension( const SharedPointer< Meshes::Grid< 3, MeshReal, Devices::Host, MeshIndex > >& meshPointer, const String& inputFileName, const Containers::List< String >& parsedObjectType, const Config::ParameterContainer& parameters ) { typedef Meshes::Grid< 3, MeshReal, Devices::Host, MeshIndex > Mesh; typedef SharedPointer< Mesh > MeshPointer; - int meshEntityDimensions = atoi( parsedObjectType[ 2 ].getString() ); - switch( meshEntityDimensions ) + int meshEntityDimension = atoi( parsedObjectType[ 2 ].getString() ); + switch( meshEntityDimension ) { case 0: return setMeshEntityType< MeshPointer, 0 >( meshPointer, inputFileName, parsedObjectType, parameters ); @@ -172,7 +172,7 @@ bool setMeshEntityDimensions( const SharedPointer< Meshes::Grid< 3, MeshReal, De return setMeshEntityType< MeshPointer, 3 >( meshPointer, inputFileName, parsedObjectType, parameters ); break; default: - std::cerr << "Unsupported mesh functions entity dimensions count " << meshEntityDimensions << "." << std::endl; + std::cerr << "Unsupported mesh functions entity dimension count " << meshEntityDimension << "." << std::endl; return false; } } @@ -188,11 +188,11 @@ bool setMeshFunction( const MeshPointer& meshPointer, std::cerr << "Incompatible mesh type for the mesh function " << inputFileName << "." << std::endl; return false; } - return setMeshEntityDimensions( meshPointer, inputFileName, parsedObjectType, parameters ); + return setMeshEntityDimension( meshPointer, inputFileName, parsedObjectType, parameters ); } -template< typename MeshPointer, typename Element, typename Real, typename Index, int Dimensions > +template< typename MeshPointer, typename Element, typename Real, typename Index, int Dimension > bool convertObject( const MeshPointer& meshPointer, const String& inputFileName, const Containers::List< String >& parsedObjectType, @@ -219,7 +219,7 @@ bool convertObject( const MeshPointer& meshPointer, Containers::Vector< Element, Devices::Host, typename MeshType::IndexType > vector; if( ! vector.load( inputFileName ) ) return false; - Functions::MeshFunction< MeshType, MeshType::meshDimensions, Element > mf; + Functions::MeshFunction< MeshType, MeshType::meshDimension, Element > mf; mf.bind( meshPointer, vector ); if( ! mf.write( outputFileName, outputFormat ) ) return false; @@ -229,14 +229,14 @@ bool convertObject( const MeshPointer& meshPointer, parsedObjectType[ 0 ] == "tnlMultiVector" || // TODO: remove deprecated type names parsedObjectType[ 0 ] == "tnlSharedMultiVector" ) // { - Containers::MultiVector< Dimensions, Element, Devices::Host, Index > multiVector; + Containers::MultiVector< Dimension, Element, Devices::Host, Index > multiVector; if( ! multiVector. load( inputFileName ) ) return false; - typedef Meshes::Grid< Dimensions, Real, Devices::Host, Index > GridType; - typedef typename GridType::VertexType VertexType; + typedef Meshes::Grid< Dimension, Real, Devices::Host, Index > GridType; + typedef typename GridType::PointType PointType; typedef typename GridType::CoordinatesType CoordinatesType; GridType grid; - grid. setDomain( VertexType( 0.0 ), VertexType( 1.0 ) ); + grid. setDomain( PointType( 0.0 ), PointType( 1.0 ) ); grid. setDimensions( CoordinatesType( multiVector. getDimensions() ) ); const Real spaceStep = grid. getSpaceSteps(). x(); if( ! grid. write( multiVector, outputFileName, outputFormat ) ) diff --git a/src/UnitTests/Containers/MultiArrayTest.h b/src/UnitTests/Containers/MultiArrayTest.h index 413ae01ca3b9ab9e701d6273110e2c46b1501339..a14fb919e4cbb34b7aaec0f1cb219280f803b06b 100644 --- a/src/UnitTests/Containers/MultiArrayTest.h +++ b/src/UnitTests/Containers/MultiArrayTest.h @@ -51,13 +51,13 @@ __global__ void testSetGetElementKernel( MultiArray< 3, ElementType, Devices::Cu TEST( MultiArrayTest, testConstructorDestructor ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > u; + MultiArray< Dimension, ElementType, Device, IndexType > u; } TEST( MultiArrayTest, testSetSize ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > u, v; + MultiArray< Dimension, ElementType, Device, IndexType > u, v; u. setDimensions( 10 ); v. setDimensions( 10 ); } @@ -105,7 +105,7 @@ IndexType getDiagonalElement( Containers::MultiArray< 3, ElementType, Device, In TEST( MultiArrayTest, testSetGetElement ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > u; + MultiArray< Dimension, ElementType, Device, IndexType > u; u. setDimensions( 10 ); if( std::is_same< Device, Devices::Host >::value ) { @@ -115,7 +115,7 @@ TEST( MultiArrayTest, testSetGetElement ) if( std::is_same< Device, Devices::Cuda >::value ) { #ifdef HAVE_CUDA - MultiArray< Dimensions, ElementType, Device, IndexType >* kernel_u = + MultiArray< Dimension, ElementType, Device, IndexType >* kernel_u = Devices::Cuda::passToDevice( u ); testSetGetElementKernel<<< 1, 16 >>>( kernel_u ); Devices::Cuda::freeFromDevice( kernel_u ); @@ -129,7 +129,7 @@ TEST( MultiArrayTest, testSetGetElement ) TEST( MultiArrayTest, testComparisonOperator ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > u, v, w; + MultiArray< Dimension, ElementType, Device, IndexType > u, v, w; u.setDimensions( 10 ); v.setDimensions( 10 ); w.setDimensions( 10 ); @@ -151,8 +151,8 @@ TEST( MultiArrayTest, testComparisonOperator ) TEST( MultiArrayTest, testEquivalenceOperator ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > u; - MultiArray< Dimensions, ElementType, Device, IndexType > v; + MultiArray< Dimension, ElementType, Device, IndexType > u; + MultiArray< Dimension, ElementType, Device, IndexType > v; u. setDimensions( 10 ); v. setDimensions( 10 ); for( int i = 0; i < 10; i ++ ) @@ -165,7 +165,7 @@ TEST( MultiArrayTest, testEquivalenceOperator ) TEST( MultiArrayTest, testGetSize ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > u; + MultiArray< Dimension, ElementType, Device, IndexType > u; const int maxSize = 10; for( int i = 1; i < maxSize; i ++ ) u. setDimensions( i ); @@ -176,7 +176,7 @@ TEST( MultiArrayTest, testGetSize ) TEST( MultiArrayTest, testReset ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > u; + MultiArray< Dimension, ElementType, Device, IndexType > u; u.setDimensions( 100 ); ASSERT_EQ( u. getDimensions().x(), 100 ); u.reset(); @@ -193,7 +193,7 @@ TEST( MultiArrayTest, testSetSizeAndDestructor ) using namespace TNL::Containers; for( int i = 1; i < 100; i ++ ) { - MultiArray< Dimensions, ElementType, Device, IndexType > u; + MultiArray< Dimension, ElementType, Device, IndexType > u; u. setDimensions( i ); } } @@ -201,7 +201,7 @@ TEST( MultiArrayTest, testSetSizeAndDestructor ) TEST( MultiArrayTest, testSaveAndLoad ) { using namespace TNL::Containers; - MultiArray< Dimensions, ElementType, Device, IndexType > v; + MultiArray< Dimension, ElementType, Device, IndexType > v; const int size( 10 ); ASSERT_TRUE( v. setDimensions( size ) ); for( int i = 0; i < size; i ++ ) @@ -210,7 +210,7 @@ TEST( MultiArrayTest, testSaveAndLoad ) file. open( "test-file.tnl", tnlWriteMode ); ASSERT_TRUE( v. save( file ) ); file. close(); - MultiArray< Dimensions, ElementType, Device, IndexType > u; + MultiArray< Dimension, ElementType, Device, IndexType > u; file. open( "test-file.tnl", tnlReadMode ); ASSERT_TRUE( u. load( file ) ); file. close(); diff --git a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h index 00d22ea2a39c12e1ba5855bc7852bfbc3fbad48c..51d957f1bf421ecbce3bb8606e6d2b8f0172410a 100644 --- a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h +++ b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace.h @@ -19,8 +19,8 @@ template< typename MeshReal, class BenchmarkLaplace< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index > : public Operators::Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, - Meshes::Grid< 1, MeshReal, Device, MeshIndex >::getMeshDimensions(), - Meshes::Grid< 1, MeshReal, Device, MeshIndex >::getMeshDimensions(), + Meshes::Grid< 1, MeshReal, Device, MeshIndex >::getMeshDimension(), + Meshes::Grid< 1, MeshReal, Device, MeshIndex >::getMeshDimension(), Real, Index > { @@ -31,7 +31,7 @@ class BenchmarkLaplace< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, In typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); @@ -67,8 +67,8 @@ template< typename MeshReal, class BenchmarkLaplace< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index > : public Operators::Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, - Meshes::Grid< 2, MeshReal, Device, MeshIndex >::getMeshDimensions(), - Meshes::Grid< 2, MeshReal, Device, MeshIndex >::getMeshDimensions(), + Meshes::Grid< 2, MeshReal, Device, MeshIndex >::getMeshDimension(), + Meshes::Grid< 2, MeshReal, Device, MeshIndex >::getMeshDimension(), Real, Index > { @@ -79,7 +79,7 @@ class BenchmarkLaplace< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Ind typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); @@ -115,8 +115,8 @@ template< typename MeshReal, class BenchmarkLaplace< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index > : public Operators::Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, - Meshes::Grid< 3, MeshReal, Device, MeshIndex >::getMeshDimensions(), - Meshes::Grid< 3, MeshReal, Device, MeshIndex >::getMeshDimensions(), + Meshes::Grid< 3, MeshReal, Device, MeshIndex >::getMeshDimension(), + Meshes::Grid< 3, MeshReal, Device, MeshIndex >::getMeshDimension(), Real, Index > { @@ -127,7 +127,7 @@ class BenchmarkLaplace< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Ind typedef Device DeviceType; typedef Index IndexType; typedef Functions::MeshFunction< MeshType > MeshFunctionType; - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; static String getType(); diff --git a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h index 7a58b9774432cb080d7d04b3475f646b1dc10960..c780716eea0ec3edca70314c5291226323470ffe 100644 --- a/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h +++ b/tests/benchmarks/heat-equation-benchmark/BenchmarkLaplace_impl.h @@ -37,14 +37,14 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 1, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 1, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 1, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 1, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse; } @@ -68,7 +68,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -95,11 +95,11 @@ setMatrixElements( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 1 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); matrixRow.setElement( 0, west, - lambdaX ); matrixRow.setElement( 1, center, 2.0 * lambdaX ); matrixRow.setElement( 2, east, - lambdaX ); @@ -141,17 +141,17 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - /*static_assert( MeshEntity::entityDimensions == 2, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 2, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + /*static_assert( MeshEntity::entityDimension == 2, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 2, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); */ + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); */ const IndexType& xSize = entity.getMesh().getDimensions().x(); const IndexType& c = entity.getIndex(); @@ -181,7 +181,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -208,14 +208,14 @@ setMatrixElements( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1 >(); matrixRow.setElement( 0, south, -lambdaY ); matrixRow.setElement( 1, west, -lambdaX ); matrixRow.setElement( 2, center, 2.0 * ( lambdaX + lambdaY ) ); @@ -259,20 +259,20 @@ operator()( const MeshFunction& u, * The following example is the Laplace operator approximated * by the Finite difference method. */ - static_assert( MeshEntity::entityDimensions == 3, "Wrong mesh entity dimensions." ); - static_assert( MeshFunction::getEntitiesDimensions() == 3, "Wrong preimage function" ); - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + static_assert( MeshEntity::entityDimension == 3, "Wrong mesh entity dimension." ); + static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& hySquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& hzSquareInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); return ( u[ west ] - 2.0 * u[ center ] + u[ east ] ) * hxSquareInverse + ( u[ south ] - 2.0 * u[ center ] + u[ north ] ) * hySquareInverse + ( u[ up ] - 2.0 * u[ center ] + u[ down ] ) * hzSquareInverse; @@ -298,7 +298,7 @@ getLinearSystemRowLength( const MeshType& mesh, * by the Finite difference method. */ - return 2*Dimensions + 1; + return 2*Dimension + 1; } template< typename MeshReal, @@ -325,17 +325,17 @@ setMatrixElements( const RealType& time, * by the Finite difference method. */ - const typename MeshEntity::template NeighbourEntities< 3 >& neighbourEntities = entity.getNeighbourEntities(); + const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); const RealType& lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >(); const RealType& lambdaY = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >(); const RealType& lambdaZ = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >(); const IndexType& center = entity.getIndex(); - const IndexType& east = neighbourEntities.template getEntityIndex< 1, 0, 0 >(); - const IndexType& west = neighbourEntities.template getEntityIndex< -1, 0, 0 >(); - const IndexType& north = neighbourEntities.template getEntityIndex< 0, 1, 0 >(); - const IndexType& south = neighbourEntities.template getEntityIndex< 0, -1, 0 >(); - const IndexType& up = neighbourEntities.template getEntityIndex< 0, 0, 1 >(); - const IndexType& down = neighbourEntities.template getEntityIndex< 0, 0, -1 >(); + const IndexType& east = neighborEntities.template getEntityIndex< 1, 0, 0 >(); + const IndexType& west = neighborEntities.template getEntityIndex< -1, 0, 0 >(); + const IndexType& north = neighborEntities.template getEntityIndex< 0, 1, 0 >(); + const IndexType& south = neighborEntities.template getEntityIndex< 0, -1, 0 >(); + const IndexType& up = neighborEntities.template getEntityIndex< 0, 0, 1 >(); + const IndexType& down = neighborEntities.template getEntityIndex< 0, 0, -1 >(); matrixRow.setElement( 0, down, -lambdaZ ); matrixRow.setElement( 1, south, -lambdaY ); matrixRow.setElement( 2, west, -lambdaX ); diff --git a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h index d80f2293d8514eb189dbee57d7f118059f05d992..96a18586f5a8f03b149f9227b776dca6396be9e6 100644 --- a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h +++ b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h @@ -23,9 +23,9 @@ template<> struct ConfigTagIndex< HeatEquationBenchmarkBuildConfigTag, long int /**** * Use of Grid is enabled for allowed dimensions and Real, Device and Index types. */ -template< int Dimensions, typename Real, typename Device, typename Index > - struct ConfigTagMesh< HeatEquationBenchmarkBuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > > - { enum { enabled = ( Dimensions == 2 ) && +template< int Dimension, typename Real, typename Device, typename Index > + struct ConfigTagMesh< HeatEquationBenchmarkBuildConfigTag, Meshes::Grid< Dimension, Real, Device, Index > > + { enum { enabled = ( Dimension == 2 ) && ConfigTagReal< HeatEquationBenchmarkBuildConfigTag, Real >::enabled && ConfigTagDevice< HeatEquationBenchmarkBuildConfigTag, Device >::enabled && ConfigTagIndex< HeatEquationBenchmarkBuildConfigTag, Index >::enabled }; }; diff --git a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkProblem_impl.h b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkProblem_impl.h index 0d457445bd8e172a80852d25e74bf185aa8b087e..07e78a73abb8daf9794d49d293afba0e6b59deb6 100644 --- a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkProblem_impl.h +++ b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkProblem_impl.h @@ -139,17 +139,17 @@ setupLinearSystem( const MeshType& mesh, Matrix& matrix ) { const IndexType dofs = this->getDofs( mesh ); - typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; - CompressedRowsLengthsVectorType rowLengths; + typedef typename Matrix::CompressedRowLengthsVector CompressedRowLengthsVectorType; + CompressedRowLengthsVectorType rowLengths; if( ! rowLengths.setSize( dofs ) ) return false; - Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; - matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh, + Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowLengthsVectorType > matrixSetter; + matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >( mesh, differentialOperatorPointer, boundaryConditionPointer, rowLengths ); matrix.setDimensions( dofs, dofs ); - if( ! matrix.setCompressedRowsLengths( rowLengths ) ) + if( ! matrix.setCompressedRowLengths( rowLengths ) ) return false; return true; } @@ -267,11 +267,11 @@ boundaryConditionsTemplatedCompact( const GridType* grid, } } -/*template< typename EntityType, int Dimensions > -struct EntityPointer : public EntityPointer< EntityType, Dimensions - 1 > +/*template< typename EntityType, int Dimension > +struct EntityPointer : public EntityPointer< EntityType, Dimension - 1 > { __device__ EntityPointer( const EntityType* ptr ) - : EntityPointer< EntityType, Dimensions - 1 >( ptr ), pointer( ptr ) + : EntityPointer< EntityType, Dimension - 1 >( ptr ), pointer( ptr ) { } @@ -524,15 +524,12 @@ getExplicitUpdate( const RealType& time, this->u->bind( mesh, uDofs ); this->fu->bind( mesh, fuDofs ); //explicitUpdater.setGPUTransferTimer( this->gpuTransferTimer ); - this->explicitUpdater.template update< typename Mesh::Cell >( - time, - mesh, - this->differentialOperatorPointer, - this->boundaryConditionPointer, - this->rightHandSidePointer, - this->u, - this->fu ); - } + explicitUpdater.setDifferentialOperator( this->differentialOperatorPointer ); + explicitUpdater.setBoundaryConditions( this->boundaryConditionPointer ); + explicitUpdater.setRightHandSide( this->rightHandSidePointer ); + + this->explicitUpdater.template update< typename Mesh::Cell >( time, tau, mesh, this->u, this->fu ); + } } } @@ -558,21 +555,15 @@ assemblyLinearSystem( const RealType& time, BoundaryCondition, RightHandSide, Solvers::PDE::BackwardTimeDiscretisation, - typename MatrixPointer::ObjectType, typename DofVectorPointer::ObjectType > systemAssembler; typedef Functions::MeshFunction< Mesh > MeshFunctionType; typedef SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer; MeshFunctionPointer u( mesh, *_u ); - systemAssembler.template assembly< typename Mesh::Cell >( time, - tau, - mesh, - this->differentialOperator, - this->boundaryCondition, - this->rightHandSide, - u, - matrix, - b ); + systemAssembler.setDifferentialOperator( this->differentialOperator ); + systemAssembler.setBoundaryConditions( this->boundaryCondition ); + systemAssembler.setRightHandSide( this->rightHandSide ); + systemAssembler.template assembly< typename Mesh::Cell >( time, tau, mesh, u, matrix, b ); } template< typename Mesh, diff --git a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h index 393028f2cbf1015705a3d5869a1cf215fa3a3293..9ba4c06c944e0906399fe3079dc98e2fc2ddbc3f 100644 --- a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h +++ b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkRhs.h @@ -2,7 +2,7 @@ #define HeatEquationBenchmarkRHS_H_ #include <TNL/Functions/Domain.h> template< typename Mesh, typename Real >class HeatEquationBenchmarkRhs - : public Functions::Domain< Mesh::meshDimensions, Functions::MeshDomain > + : public Functions::Domain< Mesh::meshDimension, Functions::MeshDomain > { public: @@ -20,8 +20,8 @@ template< typename Mesh, typename Real >class HeatEquationBenchmarkRhs Real operator()( const MeshEntity& entity, const Real& time = 0.0 ) const { - typedef typename MeshEntity::MeshType::VertexType VertexType; - VertexType v = entity.getCenter(); + typedef typename MeshEntity::MeshType::PointType PointType; + PointType v = entity.getCenter(); return 0.0; } }; diff --git a/tests/benchmarks/heat-equation-benchmark/TestGridEntity.h b/tests/benchmarks/heat-equation-benchmark/TestGridEntity.h index e72140e45871d62fb9ae7926e3aa7a53a9d31642..3492b219807f4650ed665b2ee57c77754f5934f1 100644 --- a/tests/benchmarks/heat-equation-benchmark/TestGridEntity.h +++ b/tests/benchmarks/heat-equation-benchmark/TestGridEntity.h @@ -18,12 +18,12 @@ #pragma once template< typename GridEntity > -class TestNeighbourGridEntitiesStorage +class TestNeighborGridEntitiesStorage { public: __cuda_callable__ - TestNeighbourGridEntitiesStorage( const GridEntity& entity ) + TestNeighborGridEntitiesStorage( const GridEntity& entity ) : entity( entity ) {} @@ -31,61 +31,61 @@ class TestNeighbourGridEntitiesStorage }; template< typename Grid, - int EntityDimensions > + int EntityDimension > class TestGridEntity { }; -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, - int EntityDimensions > -class TestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, EntityDimensions > + int EntityDimension > +class TestGridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension > { public: - static const int entityDimensions = EntityDimensions; + static const int entityDimension = EntityDimension; }; /**** * Specializations for cells */ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index > -class TestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions > +class TestGridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension > { public: - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; typedef GridType MeshType; typedef typename GridType::RealType RealType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; //typedef Config ConfigType; - static const int meshDimensions = GridType::meshDimensions; + static const int meshDimension = GridType::meshDimension; - static const int entityDimensions = meshDimensions; + static const int entityDimension = meshDimension; - constexpr static int getDimensions() { return entityDimensions; }; + constexpr static int getDimensions() { return entityDimension; }; - constexpr static int getMeshDimensions() { return meshDimensions; }; + constexpr static int getDimension() { return meshDimension; }; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityOrientationType; - typedef Containers::StaticVector< meshDimensions, IndexType > EntityBasisType; - typedef TestGridEntity< GridType, entityDimensions > ThisType; - typedef TestNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityOrientationType; + typedef Containers::StaticVector< meshDimension, IndexType > EntityBasisType; + typedef TestGridEntity< GridType, entityDimension > ThisType; + typedef TestNeighborGridEntitiesStorage< ThisType > NeighborGridEntitiesStorageType; __cuda_callable__ inline TestGridEntity( const GridType& grid ) : grid( grid ), /*entityIndex( -1 ),*/ - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { } @@ -98,7 +98,7 @@ class TestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimension : grid( grid ), /*entityIndex( -1 ), coordinates( coordinates ),*/ - neighbourEntitiesStorage( *this ) + neighborEntitiesStorage( *this ) { } @@ -116,7 +116,7 @@ class TestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimension EntityBasisType basis; - NeighbourGridEntitiesStorageType neighbourEntitiesStorage; + NeighborGridEntitiesStorageType neighborEntitiesStorage; }; diff --git a/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-heat-equation.h b/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-heat-equation.h index 6cacb6a2be3531c981b77b3cfb7ca46be59db374..3db5347a724356c11cf9afe8407ad7cacb5d4300 100644 --- a/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-heat-equation.h +++ b/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-heat-equation.h @@ -59,10 +59,10 @@ class HeatEquationBenchmarkSetter static bool run( const Config::ParameterContainer & parameters ) { - enum { Dimensions = MeshType::getMeshDimensions() }; + enum { Dimension = MeshType::getMeshDimension() }; typedef BenchmarkLaplace< MeshType, Real, Index > ApproximateOperator; typedef HeatEquationBenchmarkRhs< MeshType, Real > RightHandSide; - typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex; + typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point; /**** * Resolve the template arguments of your solver here. @@ -72,10 +72,10 @@ class HeatEquationBenchmarkSetter String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" ); if( parameters.checkParameter( "boundary-conditions-constant" ) ) { - typedef Functions::Analytic::Constant< Dimensions, Real > Constant; + typedef Functions::Analytic::Constant< Dimension, Real > Constant; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef HeatEquationBenchmarkProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); @@ -88,7 +88,7 @@ class HeatEquationBenchmarkSetter typedef Functions::MeshFunction< MeshType > MeshFunction; if( boundaryConditionsType == "dirichlet" ) { - typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions; typedef HeatEquationBenchmarkProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); diff --git a/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h b/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h index a53770568e4a0305e3cb0279c3f307e4a9139e69..77423501931f05d544fa8874d2d55c9a902b3674 100644 --- a/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h +++ b/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h @@ -312,11 +312,11 @@ bool solveHeatEquationCuda( const Config::ParameterContainer& parameters, } typedef Meshes::Grid< 2, Real, Devices::Cuda, Index > GridType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; typedef SharedPointer< GridType > GridPointer; GridPointer gridPointer; gridPointer->setDimensions( gridXSize, gridYSize ); - gridPointer->setDomain( VertexType( 0.0, 0.0 ), VertexType( domainXSize, domainYSize ) ); + gridPointer->setDomain( PointType( 0.0, 0.0 ), PointType( domainXSize, domainYSize ) ); Containers::Vector< Real, Devices::Cuda, Index > vecU; vecU.bind( cuda_u, gridXSize * gridYSize ); Functions::MeshFunction< GridType > meshFunction; @@ -558,10 +558,10 @@ bool solveHeatEquationHost( const Config::ParameterContainer& parameters, * Saving the result */ typedef Meshes::Grid< 2, Real, Devices::Host, Index > GridType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; SharedPointer< GridType > gridPointer; gridPointer->setDimensions( gridXSize, gridYSize ); - gridPointer->setDomain( VertexType( 0.0, 0.0 ), VertexType( domainXSize, domainYSize ) ); + gridPointer->setDomain( PointType( 0.0, 0.0 ), PointType( domainXSize, domainYSize ) ); Containers::Vector< Real, Devices::Host, Index > vecU; vecU.bind( u, gridXSize * gridYSize ); Functions::MeshFunction< GridType > meshFunction; diff --git a/tests/benchmarks/heat-equation-benchmark/tnlTestGrid2D.h b/tests/benchmarks/heat-equation-benchmark/tnlTestGrid2D.h index c4d33c9b06b9942b35cd04c0c4ff069e1050c44a..041e5b21d807551a055d4fec75ce4a8f35247186 100644 --- a/tests/benchmarks/heat-equation-benchmark/tnlTestGrid2D.h +++ b/tests/benchmarks/heat-equation-benchmark/tnlTestGrid2D.h @@ -17,7 +17,7 @@ #include <core/vectors/tnlStaticVector.h> #include <core/vectors/tnlVector.h> -template< int Dimensions, +template< int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int > @@ -32,12 +32,12 @@ class Grid : public tnlObject #include <mesh/grids/GridEntityTopology.h> #include <mesh/grids/GridEntityGetter.h> #include <mesh/grids/GridEntityConfig.h> -#include <mesh/grids/NeighbourGridEntityGetter.h> +#include <mesh/grids/NeighborGridEntityGetter.h> #include <core/tnlLogger.h> // TODO: remove this //#include <../tests/benchmarks/heat-equation-benchmark/tnlTestGridEntity.h> -//#include <../tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter2D_impl.h> +//#include <../tests/benchmarks/heat-equation-benchmark/tnlTestNeighborGridEntityGetter2D_impl.h> ///// template< typename Real, @@ -50,31 +50,31 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef tnlStaticVector< 2, Real > VertexType; + typedef tnlStaticVector< 2, Real > PointType; typedef tnlStaticVector< 2, Index > CoordinatesType; typedef Meshes::Grid< 2, Real, Devices::Host, Index > HostType; typedef Meshes::Grid< 2, Real, tnlCuda, Index > CudaType; typedef Meshes::Grid< 2, Real, Device, Index > ThisType; - static const int meshDimensions = 2; + static const int meshDimension = 2; - //template< int EntityDimensions, + //template< int EntityDimension, // typename Config = GridEntityNoStencilStorage >//CrossStencilStorage< 1 > > - //using MeshEntity = GridEntity< ThisType, EntityDimensions, Config >; + //using MeshEntity = GridEntity< ThisType, EntityDimension, Config >; - //typedef MeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > Cell; - //typedef MeshEntity< meshDimensions - 1, GridEntityNoStencilStorage > Face; - //typedef MeshEntity< 0 > Vertex; + //typedef MeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > Cell; + //typedef MeshEntity< meshDimension - 1, GridEntityNoStencilStorage > Face; + //typedef MeshEntity< 0 > Point; // TODO: remove this - template< int EntityDimensions, + template< int EntityDimension, typename Config = GridEntityNoStencilStorage >//CrossStencilStorage< 1 > > - using TestMeshEntity = tnlTestGridEntity< ThisType, EntityDimensions, Config >; - typedef TestMeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > TestCell; + using TestMeshEntity = tnlTestGridEntity< ThisType, EntityDimension, Config >; + typedef TestMeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > TestCell; ///// - static constexpr int getMeshDimensions() { return meshDimensions; }; + static constexpr int getMeshDimension() { return meshDimension; }; Grid(); @@ -93,13 +93,13 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject __cuda_callable__ inline const CoordinatesType& getDimensions() const; - void setDomain( const VertexType& origin, - const VertexType& proportions ); + void setDomain( const PointType& origin, + const PointType& proportions ); __cuda_callable__ - inline const VertexType& getOrigin() const; + inline const PointType& getOrigin() const; __cuda_callable__ - inline const VertexType& getProportions() const; + inline const PointType& getProportions() const; template< typename EntityType > __cuda_callable__ @@ -121,7 +121,7 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject RealType getCellMeasure() const; __cuda_callable__ - inline VertexType getSpaceSteps() const; + inline PointType getSpaceSteps() const; template< int xPow, int yPow > __cuda_callable__ @@ -176,9 +176,9 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject IndexType numberOfCells, numberOfNxFaces, numberOfNyFaces, numberOfFaces, numberOfVertices; - VertexType origin, proportions; + PointType origin, proportions; - VertexType spaceSteps; + PointType spaceSteps; RealType spaceStepsProducts[ 5 ][ 5 ]; @@ -192,7 +192,7 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject #include <core/tnlTNL_ASSERT.h> #include <mesh/GnuplotWriter.h> #include <mesh/grids/GridEntityGetter_impl.h> -#include <mesh/grids/NeighbourGridEntityGetter2D_impl.h> +#include <mesh/grids/NeighborGridEntityGetter2D_impl.h> #include <mesh/grids/GridEntityMeasureGetter.h> using namespace std; @@ -215,7 +215,7 @@ template< typename Real, tnlString Meshes::Grid< 2, Real, Device, Index > :: getType() { return tnlString( "Meshes::Grid< " ) + - tnlString( getMeshDimensions() ) + ", " + + tnlString( getMeshDimension() ) + ", " + tnlString( ::getType< RealType >() ) + ", " + tnlString( Device :: getDeviceType() ) + ", " + tnlString( ::getType< IndexType >() ) + " >"; @@ -344,8 +344,8 @@ Meshes::Grid< 2, Real, Device, Index > :: getDimensions() const template< typename Real, typename Device, typename Index > -void Meshes::Grid< 2, Real, Device, Index > :: setDomain( const VertexType& origin, - const VertexType& proportions ) +void Meshes::Grid< 2, Real, Device, Index > :: setDomain( const PointType& origin, + const PointType& proportions ) { this->origin = origin; this->proportions = proportions; @@ -356,7 +356,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Meshes::Grid< 2, Real, Device, Index >::VertexType& +const typename Meshes::Grid< 2, Real, Device, Index >::PointType& Meshes::Grid< 2, Real, Device, Index >::getOrigin() const { return this->origin; @@ -366,7 +366,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Meshes::Grid< 2, Real, Device, Index > :: VertexType& +const typename Meshes::Grid< 2, Real, Device, Index > :: PointType& Meshes::Grid< 2, Real, Device, Index > :: getProportions() const { return this->proportions; @@ -381,10 +381,10 @@ Index Meshes::Grid< 2, Real, Device, Index >:: getEntitiesCount() const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); - switch( EntityType::entityDimensions ) + switch( EntityType::entityDimension ) { case 2: return this->numberOfCells; @@ -405,8 +405,8 @@ EntityType Meshes::Grid< 2, Real, Device, Index >:: getEntity( const IndexType& entityIndex ) const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex ); } @@ -420,8 +420,8 @@ Index Meshes::Grid< 2, Real, Device, Index >:: getEntityIndex( const EntityType& entity ) const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity ); } @@ -454,7 +454,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -typename Meshes::Grid< 2, Real, Device, Index >::VertexType +typename Meshes::Grid< 2, Real, Device, Index >::PointType Meshes::Grid< 2, Real, Device, Index >:: getSpaceSteps() const { @@ -630,7 +630,7 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN << endl << endl; MeshEntity< 0 > vertex( *this ); CoordinatesType& vertexCoordinates = vertex.getCoordinates(); - VertexType v; + PointType v; for( Index j = 0; j < this->dimensions. y(); j ++ ) { file << "draw( "; @@ -682,13 +682,13 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN for( Index i = 0; i < this->dimensions. x(); i ++ ) for( Index j = 0; j < this->dimensions. y(); j ++ ) { - VertexType v1, v2, c; + PointType v1, v2, c; /**** * East edge normal */ - /*v1 = this->getVertex( CoordinatesType( i + 1, j ), v1 ); - v2 = this->getVertex( CoordinatesType( i + 1, j + 1 ), v2 ); + /*v1 = this->getPoint( CoordinatesType( i + 1, j ), v1 ); + v2 = this->getPoint( CoordinatesType( i + 1, j + 1 ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 1, 0 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -698,8 +698,8 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN /**** * West edge normal */ - /*this->getVertex< -1, -1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, 1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< -1, -1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, 1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< -1, 0 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -709,8 +709,8 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN /**** * North edge normal */ - /*this->getVertex< 1, 1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, 1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< 1, 1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, 1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 0, 1 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -720,8 +720,8 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN /**** * South edge normal */ - /*this->getVertex< 1, -1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, -1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< 1, -1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, -1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 0, -1 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -765,7 +765,7 @@ bool Meshes::Grid< 2, Real, Device, Index > :: write( const MeshFunction& functi { for( cellCoordinates.x() = 0; cellCoordinates.x() < getDimensions(). x(); cellCoordinates.x() ++ ) { - VertexType v = cell.getCenter(); + PointType v = cell.getCenter(); GnuplotWriter::write( file, v ); GnuplotWriter::write( file, function[ this->getEntityIndex( cell ) ] ); file << endl; @@ -784,7 +784,7 @@ void Meshes::Grid< 2, Real, Device, Index >:: writeProlog( tnlLogger& logger ) { - logger.writeParameter( "Dimensions:", getMeshDimensions() ); + logger.writeParameter( "Dimension:", getMeshDimension() ); logger.writeParameter( "Domain origin:", this->origin ); logger.writeParameter( "Domain proportions:", this->proportions ); logger.writeParameter( "Domain dimensions:", this->dimensions ); @@ -801,7 +801,7 @@ writeProlog( tnlLogger& logger ) #ifdef UNDEF -template< int Dimensions, +template< int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int > @@ -826,31 +826,31 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef tnlStaticVector< 2, Real > VertexType; + typedef tnlStaticVector< 2, Real > PointType; typedef tnlStaticVector< 2, Index > CoordinatesType; typedef Meshes::Grid< 2, Real, Devices::Host, Index > HostType; typedef Meshes::Grid< 2, Real, tnlCuda, Index > CudaType; typedef Meshes::Grid< 2, Real, Device, Index > ThisType; - static const int meshDimensions = 2; + static const int meshDimension = 2; - /*template< int EntityDimensions, + /*template< int EntityDimension, typename Config = GridEntityNoStencilStorage >//CrossStencilStorage< 1 > > - using MeshEntity = GridEntity< ThisType, EntityDimensions, Config >; + using MeshEntity = GridEntity< ThisType, EntityDimension, Config >; - typedef MeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > Cell; - typedef MeshEntity< meshDimensions - 1, GridEntityNoStencilStorage > Face; - typedef MeshEntity< 0 > Vertex;*/ + typedef MeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > Cell; + typedef MeshEntity< meshDimension - 1, GridEntityNoStencilStorage > Face; + typedef MeshEntity< 0 > Point;*/ // TODO: remove this - template< int EntityDimensions, + template< int EntityDimension, typename Config = GridEntityNoStencilStorage >//CrossStencilStorage< 1 > > - using TestMeshEntity = tnlTestGridEntity< ThisType, EntityDimensions, Config >; - typedef TestMeshEntity< meshDimensions, GridEntityCrossStencilStorage< 1 > > Cell; + using TestMeshEntity = tnlTestGridEntity< ThisType, EntityDimension, Config >; + typedef TestMeshEntity< meshDimension, GridEntityCrossStencilStorage< 1 > > Cell; ///// - static constexpr int getMeshDimensions() { return meshDimensions; }; + static constexpr int getMeshDimension() { return meshDimension; }; Grid(); @@ -869,13 +869,13 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject __cuda_callable__ inline const CoordinatesType& getDimensions() const; - void setDomain( const VertexType& origin, - const VertexType& proportions ); + void setDomain( const PointType& origin, + const PointType& proportions ); __cuda_callable__ - inline const VertexType& getOrigin() const; + inline const PointType& getOrigin() const; __cuda_callable__ - inline const VertexType& getProportions() const; + inline const PointType& getProportions() const; template< typename EntityType > __cuda_callable__ @@ -897,7 +897,7 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject RealType getCellMeasure() const; __cuda_callable__ - inline VertexType getSpaceSteps() const; + inline PointType getSpaceSteps() const; template< int xPow, int yPow > __cuda_callable__ @@ -952,9 +952,9 @@ class Meshes::Grid< 2, Real, Device, Index > : public tnlObject IndexType numberOfCells, numberOfNxFaces, numberOfNyFaces, numberOfFaces, numberOfVertices; - VertexType origin, proportions; + PointType origin, proportions; - VertexType spaceSteps; + PointType spaceSteps; RealType spaceStepsProducts[ 5 ][ 5 ]; @@ -980,7 +980,7 @@ template< typename Real, tnlString Meshes::Grid< 2, Real, Device, Index > :: getType() { return tnlString( "Meshes::Grid< " ) + - tnlString( getMeshDimensions() ) + ", " + + tnlString( getMeshDimension() ) + ", " + tnlString( ::getType< RealType >() ) + ", " + tnlString( Device :: getDeviceType() ) + ", " + tnlString( ::getType< IndexType >() ) + " >"; @@ -1109,8 +1109,8 @@ Meshes::Grid< 2, Real, Device, Index > :: getDimensions() const template< typename Real, typename Device, typename Index > -void Meshes::Grid< 2, Real, Device, Index > :: setDomain( const VertexType& origin, - const VertexType& proportions ) +void Meshes::Grid< 2, Real, Device, Index > :: setDomain( const PointType& origin, + const PointType& proportions ) { this->origin = origin; this->proportions = proportions; @@ -1121,7 +1121,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Meshes::Grid< 2, Real, Device, Index >::VertexType& +const typename Meshes::Grid< 2, Real, Device, Index >::PointType& Meshes::Grid< 2, Real, Device, Index >::getOrigin() const { return this->origin; @@ -1131,7 +1131,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -const typename Meshes::Grid< 2, Real, Device, Index > :: VertexType& +const typename Meshes::Grid< 2, Real, Device, Index > :: PointType& Meshes::Grid< 2, Real, Device, Index > :: getProportions() const { return this->proportions; @@ -1146,10 +1146,10 @@ Index Meshes::Grid< 2, Real, Device, Index >:: getEntitiesCount() const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); - switch( EntityType::entityDimensions ) + switch( EntityType::entityDimension ) { case 2: return this->numberOfCells; @@ -1170,8 +1170,8 @@ EntityType Meshes::Grid< 2, Real, Device, Index >:: getEntity( const IndexType& entityIndex ) const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntity( *this, entityIndex ); } @@ -1185,8 +1185,8 @@ Index Meshes::Grid< 2, Real, Device, Index >:: getEntityIndex( const EntityType& entity ) const { - static_assert( EntityType::entityDimensions <= 2 && - EntityType::entityDimensions >= 0, "Wrong grid entity dimensions." ); + static_assert( EntityType::entityDimension <= 2 && + EntityType::entityDimension >= 0, "Wrong grid entity dimension." ); return GridEntityGetter< ThisType, EntityType >::getEntityIndex( *this, entity ); } @@ -1219,7 +1219,7 @@ template< typename Real, typename Device, typename Index > __cuda_callable__ inline -typename Meshes::Grid< 2, Real, Device, Index >::VertexType +typename Meshes::Grid< 2, Real, Device, Index >::PointType Meshes::Grid< 2, Real, Device, Index >:: getSpaceSteps() const { @@ -1395,7 +1395,7 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN << endl << endl; TestMeshEntity< 0 > vertex( *this ); CoordinatesType& vertexCoordinates = vertex.getCoordinates(); - VertexType v; + PointType v; for( Index j = 0; j < this->dimensions. y(); j ++ ) { file << "draw( "; @@ -1447,13 +1447,13 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN for( Index i = 0; i < this->dimensions. x(); i ++ ) for( Index j = 0; j < this->dimensions. y(); j ++ ) { - VertexType v1, v2, c; + PointType v1, v2, c; /**** * East edge normal */ - /*v1 = this->getVertex( CoordinatesType( i + 1, j ), v1 ); - v2 = this->getVertex( CoordinatesType( i + 1, j + 1 ), v2 ); + /*v1 = this->getPoint( CoordinatesType( i + 1, j ), v1 ); + v2 = this->getPoint( CoordinatesType( i + 1, j + 1 ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 1, 0 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -1463,8 +1463,8 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN /**** * West edge normal */ - /*this->getVertex< -1, -1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, 1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< -1, -1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, 1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< -1, 0 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -1474,8 +1474,8 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN /**** * North edge normal */ - /*this->getVertex< 1, 1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, 1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< 1, 1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, 1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 0, 1 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -1485,8 +1485,8 @@ bool Meshes::Grid< 2, Real, Device, Index > :: writeMesh( const tnlString& fileN /**** * South edge normal */ - /*this->getVertex< 1, -1 >( CoordinatesType( i, j ), v1 ); - this->getVertex< -1, -1 >( CoordinatesType( i, j ), v2 ); + /*this->getPoint< 1, -1 >( CoordinatesType( i, j ), v1 ); + this->getPoint< -1, -1 >( CoordinatesType( i, j ), v2 ); c = ( ( Real ) 0.5 ) * ( v1 + v2 ); this->getEdgeNormal< 0, -1 >( CoordinatesType( i, j ), v ); v *= 0.5; @@ -1530,7 +1530,7 @@ bool Meshes::Grid< 2, Real, Device, Index > :: write( const MeshFunction& functi { for( cellCoordinates.x() = 0; cellCoordinates.x() < getDimensions(). x(); cellCoordinates.x() ++ ) { - VertexType v = cell.getCenter(); + PointType v = cell.getCenter(); GnuplotWriter::write( file, v ); GnuplotWriter::write( file, function[ this->getEntityIndex( cell ) ] ); file << endl; @@ -1549,7 +1549,7 @@ void Meshes::Grid< 2, Real, Device, Index >:: writeProlog( tnlLogger& logger ) { - logger.writeParameter( "Dimensions:", getMeshDimensions() ); + logger.writeParameter( "Dimension:", getMeshDimension() ); logger.writeParameter( "Domain origin:", this->origin ); logger.writeParameter( "Domain proportions:", this->proportions ); logger.writeParameter( "Domain dimensions:", this->dimensions ); diff --git a/tests/benchmarks/heat-equation-benchmark/tnlTestGridEntity.h b/tests/benchmarks/heat-equation-benchmark/tnlTestGridEntity.h index db0228ff1685026ca9a9a55b86ba1195fa58f4b0..d798bc374af4bb1fb4826ebbbbbb0056ebd09941 100644 --- a/tests/benchmarks/heat-equation-benchmark/tnlTestGridEntity.h +++ b/tests/benchmarks/heat-equation-benchmark/tnlTestGridEntity.h @@ -18,7 +18,7 @@ #pragma once template< typename Grid, - int EntityDimensions, + int EntityDimension, typename Config > class tnlTestGridEntity { @@ -27,51 +27,51 @@ class tnlTestGridEntity /**** * Specializations for cells */ -template< int Dimensions, +template< int Dimension, typename Real, typename Device, typename Index, typename Config > -class tnlTestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimensions, Config > +class tnlTestGridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config > { public: - typedef Meshes::Grid< Dimensions, Real, Device, Index > GridType; + typedef Meshes::Grid< Dimension, Real, Device, Index > GridType; typedef GridType MeshType; typedef typename GridType::RealType RealType; typedef typename GridType::IndexType IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; typedef Config ConfigType; - static const int meshDimensions = GridType::meshDimensions; + static const int meshDimension = GridType::meshDimension; - static const int entityDimensions = meshDimensions; + static const int entityDimension = meshDimension; - constexpr static int getDimensions() { return entityDimensions; }; + constexpr static int getDimension() { return entityDimension; }; - constexpr static int getMeshDimensions() { return meshDimensions; }; + constexpr static int getDimension() { return meshDimension; }; - typedef tnlStaticVector< meshDimensions, IndexType > EntityOrientationType; - typedef tnlStaticVector< meshDimensions, IndexType > EntityBasisType; - typedef tnlTestGridEntity< GridType, entityDimensions, Config > ThisType; - //typedef tnlTestNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType; + typedef tnlStaticVector< meshDimension, IndexType > EntityOrientationType; + typedef tnlStaticVector< meshDimension, IndexType > EntityBasisType; + typedef tnlTestGridEntity< GridType, entityDimension, Config > ThisType; + //typedef tnlTestNeighborGridEntitiesStorage< ThisType > NeighborGridEntitiesStorageType; - /*template< int NeighbourEntityDimensions = entityDimensions > - using NeighbourEntities = - tnlTestNeighbourGridEntityGetter< - tnlTestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, - entityDimensions, + /*template< int NeighborEntityDimension = entityDimension > + using NeighborEntities = + tnlTestNeighborGridEntityGetter< + tnlTestGridEntity< Meshes::Grid< Dimension, Real, Device, Index >, + entityDimension, Config >, - NeighbourEntityDimensions >;*/ + NeighborEntityDimension >;*/ __cuda_callable__ inline tnlTestGridEntity( const GridType& grid ) : grid( grid ), entityIndex( -1 )/*, - neighbourEntitiesStorage( *this )*/ + neighborEntitiesStorage( *this )*/ { this->coordinates = CoordinatesType( ( Index ) 0 ); this->orientation = EntityOrientationType( ( Index ) 0 ); @@ -87,7 +87,7 @@ class tnlTestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimens : grid( grid ), entityIndex( -1 ), coordinates( coordinates )/*, - neighbourEntitiesStorage( *this )*/ + neighborEntitiesStorage( *this )*/ { this->orientation = EntityOrientationType( ( Index ) 0 ); this->basis = EntityBasisType( ( Index ) 1 ); @@ -107,7 +107,7 @@ class tnlTestGridEntity< Meshes::Grid< Dimensions, Real, Device, Index >, Dimens EntityBasisType basis; - //NeighbourGridEntitiesStorageType neighbourEntitiesStorage; + //NeighborGridEntitiesStorageType neighborEntitiesStorage; }; diff --git a/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntitiesStorage.h b/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntitiesStorage.h index 410aa195976294a6681c44c7591c82c66135870c..f066ef3e3d2ea95531ddbdcbf27714d2f551875c 100644 --- a/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntitiesStorage.h +++ b/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntitiesStorage.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlTestNeighbourGridEntitiesStorage.h - description + tnlTestNeighborGridEntitiesStorage.h - description ------------------- begin : Dec 18, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -19,24 +19,24 @@ #pragma once #include <core/tnlCuda.h> -#include <mesh/MeshDimensionsTag.h> -#include "tnlTestNeighbourGridEntityGetter.h" +#include <mesh/MeshDimensionTag.h> +#include "tnlTestNeighborGridEntityGetter.h" template< typename GridEntity, - int NeighbourEntityDimensions > -class tnlTestNeighbourGridEntityLayer -: public tnlTestNeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1 > + int NeighborEntityDimension > +class tnlTestNeighborGridEntityLayer +: public tnlTestNeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1 > { public: - typedef tnlTestNeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions - 1 > BaseType; - typedef tnlTestNeighbourGridEntityGetter< GridEntity, NeighbourEntityDimensions > NeighbourEntityGetterType; + typedef tnlTestNeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1 > BaseType; + typedef tnlTestNeighborGridEntityGetter< GridEntity, NeighborEntityDimension > NeighborEntityGetterType; - using BaseType::getNeighbourEntities; + using BaseType::getNeighborEntities; __cuda_callable__ - tnlTestNeighbourGridEntityLayer( const GridEntity& entity ) - : neighbourEntities( entity ), + tnlTestNeighborGridEntityLayer( const GridEntity& entity ) + : neighborEntities( entity ), BaseType( entity ) {} @@ -45,51 +45,51 @@ class tnlTestNeighbourGridEntityLayer const typename GridEntity::GridType::IndexType& entityIndex ) { BaseType::refresh( grid, entityIndex ); - neighbourEntities.refresh( grid, entityIndex ); + neighborEntities.refresh( grid, entityIndex ); }; protected: - NeighbourEntityGetterType neighbourEntities; + NeighborEntityGetterType neighborEntities; }; template< typename GridEntity > -class tnlTestNeighbourGridEntityLayer< GridEntity, 0 > +class tnlTestNeighborGridEntityLayer< GridEntity, 0 > { public: - typedef tnlTestNeighbourGridEntityGetter< GridEntity, 0 > NeighbourEntityGetterType; + typedef tnlTestNeighborGridEntityGetter< GridEntity, 0 > NeighborEntityGetterType; __cuda_callable__ - tnlTestNeighbourGridEntityLayer( const GridEntity& entity ) - : neighbourEntities( entity ) + tnlTestNeighborGridEntityLayer( const GridEntity& entity ) + : neighborEntities( entity ) {} __cuda_callable__ void refresh( const typename GridEntity::GridType& grid, const typename GridEntity::GridType::IndexType& entityIndex ) { - neighbourEntities.refresh( grid, entityIndex ); + neighborEntities.refresh( grid, entityIndex ); }; protected: - NeighbourEntityGetterType neighbourEntities; + NeighborEntityGetterType neighborEntities; }; template< typename GridEntity > -class tnlTestNeighbourGridEntitiesStorage -: public tnlTestNeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions > +class tnlTestNeighborGridEntitiesStorage +: public tnlTestNeighborGridEntityLayer< GridEntity, GridEntity::meshDimension > { - typedef tnlTestNeighbourGridEntityLayer< GridEntity, GridEntity::meshDimensions > BaseType; + typedef tnlTestNeighborGridEntityLayer< GridEntity, GridEntity::meshDimension > BaseType; public: - using BaseType::getNeighbourEntities; + using BaseType::getNeighborEntities; __cuda_callable__ - tnlTestNeighbourGridEntitiesStorage( const GridEntity& entity ) + tnlTestNeighborGridEntitiesStorage( const GridEntity& entity ) : BaseType( entity ) {} diff --git a/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter.h b/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter.h index 946be827f9c760d315866a10059fc3f2afa442f4..521c58ff56902084a602e33bf131808e33d54862 100644 --- a/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter.h +++ b/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlTestNeighbourGridEntityGetter.h - description + tnlTestNeighborGridEntityGetter.h - description ------------------- begin : Nov 23, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -21,17 +21,17 @@ template< typename GridEntity, - int NeighbourEntityDimensions, + int NeighborEntityDimension, typename EntityStencilTag = - GridEntityStencilStorageTag< GridEntity::ConfigType::template neighbourEntityStorage< GridEntity >( NeighbourEntityDimensions ) > > -class tnlTestNeighbourGridEntityGetter + GridEntityStencilStorageTag< GridEntity::ConfigType::template neighborEntityStorage< GridEntity >( NeighborEntityDimension ) > > +class tnlTestNeighborGridEntityGetter { public: // TODO: not all specializations are implemented yet __cuda_callable__ - tnlTestNeighbourGridEntityGetter( const GridEntity& entity ) + tnlTestNeighborGridEntityGetter( const GridEntity& entity ) { //tnlTNL_ASSERT( false, ); }; @@ -50,25 +50,25 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class tnlTestNeighbourGridEntityGetter< +class tnlTestNeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 2, StencilStorage > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetter; __cuda_callable__ inline - tnlTestNeighbourGridEntityGetter( const GridEntityType& entity ) + tnlTestNeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} @@ -79,7 +79,7 @@ class tnlTestNeighbourGridEntityGetter< const GridEntityType& entity; - //tnlTestNeighbourGridEntityGetter(){}; + //tnlTestNeighborGridEntityGetter(){}; }; diff --git a/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter2D_impl.h b/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter2D_impl.h index b3a0f6df44a8fb1aa2aa435444f8910fff563685..3115229c73c17167ea02ac6f6640f2772cfeea5b 100644 --- a/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter2D_impl.h +++ b/tests/benchmarks/heat-equation-benchmark/tnlTestNeighbourGridEntityGetter2D_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlTestNeighbourGridEntityGetter2D_impl.h - description + tnlTestNeighborGridEntityGetter2D_impl.h - description ------------------- begin : Nov 23, 2015 copyright : (C) 2015 by Tomas Oberhuber @@ -17,13 +17,13 @@ #pragma once -#include "tnlTestNeighbourGridEntityGetter.h" +#include "tnlTestNeighborGridEntityGetter.h" #include <mesh/grids/Grid2D.h> #include <core/tnlStaticFor.h> /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 2 | 2 | No specialization | * +-----------------+---------------------------+-------------------+ @@ -33,25 +33,25 @@ template< typename Real, typename Index, typename Config, typename StencilStorage > -class tnlTestNeighbourGridEntityGetter< +class tnlTestNeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 2, StencilStorage > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetter; __cuda_callable__ inline - tnlTestNeighbourGridEntityGetter( const GridEntityType& entity ) + tnlTestNeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} @@ -62,12 +62,12 @@ class tnlTestNeighbourGridEntityGetter< const GridEntityType& entity; - //tnlTestNeighbourGridEntityGetter(){}; + //tnlTestNeighborGridEntityGetter(){}; }; /**** * +-----------------+---------------------------+-------------------+ - * | EntityDimenions | NeighbourEntityDimensions | Stencil Storage | + * | EntityDimenions | NeighborEntityDimension | Stencil Storage | * +-----------------+---------------------------+-------------------+ * | 2 | 2 | Cross | * +-----------------+---------------------------+-------------------+ @@ -76,30 +76,30 @@ template< typename Real, typename Device, typename Index, typename Config > -class tnlTestNeighbourGridEntityGetter< +class tnlTestNeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 2, GridEntityStencilStorageTag< GridEntityCrossStencil > > { public: - static const int EntityDimensions = 2; - static const int NeighbourEntityDimensions = 2; + static const int EntityDimension = 2; + static const int NeighborEntityDimension = 2; typedef Meshes::Grid< 2, Real, Device, Index > GridType; - typedef GridEntity< GridType, EntityDimensions, Config > GridEntityType; - typedef GridEntity< GridType, NeighbourEntityDimensions, Config > NeighbourGridEntityType; + typedef GridEntity< GridType, EntityDimension, Config > GridEntityType; + typedef GridEntity< GridType, NeighborEntityDimension, Config > NeighborGridEntityType; typedef Real RealType; typedef Index IndexType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef GridEntityGetter< GridType, NeighbourGridEntityType > GridEntityGetter; + typedef GridEntityGetter< GridType, NeighborGridEntityType > GridEntityGetter; typedef GridEntityStencilStorageTag< GridEntityCrossStencil > StencilStorage; - typedef tnlTestNeighbourGridEntityGetter< GridEntityType, 2, StencilStorage > ThisType; + typedef tnlTestNeighborGridEntityGetter< GridEntityType, 2, StencilStorage > ThisType; static const int stencilSize = Config::getStencilSize(); __cuda_callable__ inline - tnlTestNeighbourGridEntityGetter( const GridEntityType& entity ) + tnlTestNeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {} @@ -110,9 +110,9 @@ class tnlTestNeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencilX[ index + stencilSize ] = entityIndex + index; + neighborEntityGetter.stencilX[ index + stencilSize ] = entityIndex + index; } }; @@ -122,10 +122,10 @@ class tnlTestNeighbourGridEntityGetter< public: __cuda_callable__ - static void exec( ThisType& neighbourEntityGetter, const IndexType& entityIndex ) + static void exec( ThisType& neighborEntityGetter, const IndexType& entityIndex ) { - neighbourEntityGetter.stencilY[ index + stencilSize ] = - entityIndex + index * neighbourEntityGetter.entity.getMesh().getDimensions().x(); + neighborEntityGetter.stencilY[ index + stencilSize ] = + entityIndex + index * neighborEntityGetter.entity.getMesh().getDimensions().x(); } }; @@ -147,6 +147,6 @@ class tnlTestNeighbourGridEntityGetter< IndexType stencilX[ 2 * stencilSize + 1 ]; IndexType stencilY[ 2 * stencilSize + 1 ]; - //tnlTestNeighbourGridEntityGetter(){}; + //tnlTestNeighborGridEntityGetter(){}; }; diff --git a/tests/benchmarks/spmv.h b/tests/benchmarks/spmv.h index 126a3d6f57d2f321d3338f7dfc44a71341204ab0..6fbd68dfb2bae574e47a05ea1f7e49f2b90532d4 100644 --- a/tests/benchmarks/spmv.h +++ b/tests/benchmarks/spmv.h @@ -142,14 +142,14 @@ benchmarkSpMV( Benchmark & benchmark, deviceRowLengths.setValue( elementsPerRow ); #endif - if( ! hostMatrix.setCompressedRowsLengths( hostRowLengths ) ) { + if( ! hostMatrix.setCompressedRowLengths( hostRowLengths ) ) { const char* msg = "error: allocation of host matrix failed"; std::cerr << msg << std::endl; benchmark.addErrorMessage( msg, 2 ); return false; } #ifdef HAVE_CUDA - if( ! deviceMatrix.setCompressedRowsLengths( deviceRowLengths ) ) { + if( ! deviceMatrix.setCompressedRowLengths( deviceRowLengths ) ) { const char* msg = "error: allocation of device matrix failed"; std::cerr << msg << std::endl; benchmark.addErrorMessage( msg, 2 ); diff --git a/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h b/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h index b7951a294bf75c0bf79c899d47dba6a0e1c8a125..2e077e9c3d9057e90819073cf48f56743e113096 100644 --- a/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h +++ b/tests/unit-tests/core/multimaps/tnlIndexMultimapTester.h @@ -152,7 +152,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m1.getRows() ); rowLengths.setValue( 5 ); - m1.setCompressedRowsLengths( rowLengths ); + m1.setCompressedRowLengths( rowLengths ); m2.setLike( m1 ); CPPUNIT_ASSERT( m1.getRows() == m2.getRows() ); }*/ @@ -193,7 +193,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::getDevice() == Devices::HostDevice ) { @@ -233,7 +233,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -258,7 +258,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) { @@ -304,7 +304,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -321,7 +321,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = 9; j >= 0; j-- ) m.setElement( i, j, i+j ); @@ -339,7 +339,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) { @@ -377,7 +377,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) { for( int i = 9; i >= 0; i-- ) @@ -418,7 +418,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) for( int j = 0; j <= i; j++ ) @@ -433,7 +433,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = i; j >= 0; j-- ) m.setElement( i, j, i + j ); @@ -455,7 +455,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) { @@ -491,7 +491,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) { for( int i = 9; i >= 0; i-- ) @@ -534,7 +534,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); for( int i = 0; i < 10; i++ ) @@ -564,7 +564,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 1 ]; IndexType columnIndexes[ 1 ]; @@ -595,7 +595,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) @@ -649,7 +649,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; IndexType columnIndexes[ 10 ]; @@ -675,7 +675,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) { for( int j = 9; j >= 0; j-- ) @@ -696,7 +696,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; IndexType columnIndexes[ 10 ]; @@ -745,7 +745,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) { @@ -790,7 +790,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; @@ -815,7 +815,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) { for( int j = i; j >= 0; j-- ) @@ -840,7 +840,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; @@ -886,7 +886,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( DeviceType::DeviceType == ( int ) Devices::HostDevice ) { @@ -938,7 +938,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { v.setElement( i, i ); @@ -962,7 +962,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( size ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { for( int j = 0; j < size; j++ ) @@ -987,7 +987,7 @@ class tnlIndexMultimapTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( size ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { for( int j = 0; j <= i; j++ ) diff --git a/tests/unit-tests/functions/tnlOperatorFunctionTest.h b/tests/unit-tests/functions/tnlOperatorFunctionTest.h index 302f0295a6a440ac38bb6559063993667be46cab..d50852c60d3929e4c388d6774c8c1702fc185583 100644 --- a/tests/unit-tests/functions/tnlOperatorFunctionTest.h +++ b/tests/unit-tests/functions/tnlOperatorFunctionTest.h @@ -40,9 +40,9 @@ class OperatorFunctionTest typedef typename OperatorType::RealType RealType; typedef typename OperatorType::IndexType IndexType; typedef typename MeshType::CoordinatesType CoordinatesType; - typedef typename MeshType::VertexType VertexType; - typedef Functions::Analytic::ExpBump< MeshType::getMeshDimensions(), RealType > TestFunctionType; - typedef Functions::MeshFunction< MeshType, MeshType::getMeshDimensions() > MeshFunctionType; + typedef typename MeshType::PointType PointType; + typedef Functions::Analytic::ExpBump< MeshType::getMeshDimension(), RealType > TestFunctionType; + typedef Functions::MeshFunction< MeshType, MeshType::getMeshDimension() > MeshFunctionType; typedef SharedPointer< MeshType > MeshPointer; OperatorFunctionTest(){}; @@ -65,7 +65,7 @@ class OperatorFunctionTest MeshPointer meshPointer; typedef Functions::OperatorFunction< Operator, MeshFunctionType, void, EvaluateOnFly > OperatorFunctionType; meshPointer->setDimensions( CoordinatesType( 25 ) ); - meshPointer->setDomain( VertexType( -1.0 ), VertexType( 2.0 ) ); + meshPointer->setDomain( PointType( -1.0 ), PointType( 2.0 ) ); TestFunctionType testFunction; testFunction.setAmplitude( 1.0 ); testFunction.setSigma( 1.0 ); @@ -94,7 +94,7 @@ class OperatorFunctionTest typedef Operators::DirichletBoundaryConditions< MeshType > BoundaryConditionsType; typedef Functions::OperatorFunction< Operator, MeshFunctionType, BoundaryConditionsType, EvaluateOnFly > OperatorFunctionType; mesh->setDimensions( CoordinatesType( 25 ) ); - mesh->setDomain( VertexType( -1.0 ), VertexType( 2.0 ) ); + mesh->setDomain( PointType( -1.0 ), PointType( 2.0 ) ); TestFunctionType testFunction; testFunction.setAmplitude( 1.0 ); testFunction.setSigma( 1.0 ); diff --git a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h index f5acdf0f5dabe2b7c47e6bec9e63ce5da38e3b9f..a98a85ab103f1354481a1d67f926f7f4b2c650db 100644 --- a/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h +++ b/tests/unit-tests/matrices/tnlChunkedEllpackMatrixTester.h @@ -80,7 +80,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m1.getRows() ); rowLengths.setValue( 5 ); - m1.setCompressedRowsLengths( rowLengths ); + m1.setCompressedRowLengths( rowLengths ); m2.setLike( m1 ); CPPUNIT_ASSERT( m1.getRows() == m2.getRows() ); } @@ -95,7 +95,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 7; i++ ) CPPUNIT_ASSERT( m.setElement( 0, i, i ) ); @@ -112,7 +112,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -139,7 +139,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -159,7 +159,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase m.setDimensions( 10, 10 ); m.setNumberOfChunksInSlice( SliceSize ); m.setDesiredChunkSize( ChunkSize ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = 9; j >= 0; j-- ) m.setElement( i, j, i+j ); @@ -180,7 +180,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) for( int j = 0; j <= i; j++ ) @@ -195,7 +195,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = i; j >= 0; j-- ) m.setElement( i, j, i + j ); @@ -218,7 +218,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); for( int i = 0; i < 10; i++ ) @@ -251,7 +251,7 @@ class ChunkedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { v.setElement( i, i ); diff --git a/tests/unit-tests/matrices/tnlEllpackMatrixTester.h b/tests/unit-tests/matrices/tnlEllpackMatrixTester.h index d4042a6465b52118d6ec1c18cf97bed0b794d349..f6982932826c87eab6c48278e1f46a0e2ca21981 100644 --- a/tests/unit-tests/matrices/tnlEllpackMatrixTester.h +++ b/tests/unit-tests/matrices/tnlEllpackMatrixTester.h @@ -67,7 +67,7 @@ class EllpackTester : public CppUnit :: TestCase { MatrixType m1, m2; m1.setDimensions( 10, 10 ); - m1.setConstantCompressedRowsLengths( 5 ); + m1.setConstantCompressedRowLengths( 5 ); m2.setLike( m1 ); CPPUNIT_ASSERT( m1.getRows() == m2.getRows() ); } @@ -76,7 +76,7 @@ class EllpackTester : public CppUnit :: TestCase { MatrixType m; m.setDimensions( 10, 10 ); - m.setConstantCompressedRowsLengths( 7 ); + m.setConstantCompressedRowLengths( 7 ); for( int i = 0; i < 7; i++ ) CPPUNIT_ASSERT( m.setElement( 0, i, i ) ); @@ -87,7 +87,7 @@ class EllpackTester : public CppUnit :: TestCase { MatrixType m; m.setDimensions( 10, 10 ); - m.setConstantCompressedRowsLengths( 7 ); + m.setConstantCompressedRowLengths( 7 ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -103,7 +103,7 @@ class EllpackTester : public CppUnit :: TestCase { MatrixType m; m.setDimensions( 10, 10 ); - m.setConstantCompressedRowsLengths( 10 ); + m.setConstantCompressedRowLengths( 10 ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -120,7 +120,7 @@ class EllpackTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setConstantCompressedRowsLengths( 10 ); + m.setConstantCompressedRowLengths( 10 ); for( int i = 9; i >= 0; i-- ) for( int j = 9; j >= 0; j-- ) m.setElement( i, j, i+j ); @@ -134,7 +134,7 @@ class EllpackTester : public CppUnit :: TestCase { MatrixType m; m.setDimensions( 10, 10 ); - m.setConstantCompressedRowsLengths( 7 ); + m.setConstantCompressedRowLengths( 7 ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); for( int i = 0; i < 10; i++ ) @@ -161,7 +161,7 @@ class EllpackTester : public CppUnit :: TestCase w.setSize( size ); MatrixType m; m.setDimensions( size, size ); - m.setConstantCompressedRowsLengths( 7 ); + m.setConstantCompressedRowLengths( 7 ); for( int i = 0; i < size; i++ ) { v.setElement( i, i ); diff --git a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h index 4a4cb7bac11f669cb68628f56b7b166c5cfc6e6c..32e4443f5291e06f5817e21f48b3a5e6866d9ab3 100644 --- a/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h +++ b/tests/unit-tests/matrices/tnlSlicedEllpackMatrixTester.h @@ -72,7 +72,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m1.getRows() ); rowLengths.setValue( 5 ); - m1.setCompressedRowsLengths( rowLengths ); + m1.setCompressedRowLengths( rowLengths ); m2.setLike( m1 ); CPPUNIT_ASSERT( m1.getRows() == m2.getRows() ); } @@ -84,7 +84,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 7; i++ ) CPPUNIT_ASSERT( m.setElement( 0, i, i ) ); @@ -98,7 +98,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -122,7 +122,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -139,7 +139,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = 9; j >= 0; j-- ) m.setElement( i, j, i+j ); @@ -157,7 +157,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) for( int j = 0; j <= i; j++ ) @@ -172,7 +172,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = i; j >= 0; j-- ) m.setElement( i, j, i + j ); @@ -192,7 +192,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); for( int i = 0; i < 10; i++ ) @@ -222,7 +222,7 @@ class SlicedEllpackTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { v.setElement( i, i ); diff --git a/tests/unit-tests/matrices/tnlSparseMatrixTester.h b/tests/unit-tests/matrices/tnlSparseMatrixTester.h index ea1fd9c9ff0a7e883a56ae2792c161267a3c2863..0bf1da58c83c8df00f55ff6066525cae28e2899d 100644 --- a/tests/unit-tests/matrices/tnlSparseMatrixTester.h +++ b/tests/unit-tests/matrices/tnlSparseMatrixTester.h @@ -155,7 +155,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m1.getRows() ); rowLengths.setValue( 5 ); - m1.setCompressedRowsLengths( rowLengths ); + m1.setCompressedRowLengths( rowLengths ); m2.setLike( m1 ); CPPUNIT_ASSERT( m1.getRows() == m2.getRows() ); } @@ -171,7 +171,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 7; i++ ) CPPUNIT_ASSERT( m.setElement( 0, i, i ) ); @@ -191,7 +191,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { @@ -231,7 +231,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -256,7 +256,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { @@ -302,7 +302,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); @@ -319,7 +319,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = 9; j >= 0; j-- ) m.setElement( i, j, i+j ); @@ -337,7 +337,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { @@ -375,7 +375,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { for( int i = 9; i >= 0; i-- ) @@ -416,7 +416,7 @@ class SparseTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) for( int j = 0; j <= i; j++ ) @@ -431,7 +431,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) for( int j = i; j >= 0; j-- ) m.setElement( i, j, i + j ); @@ -453,7 +453,7 @@ class SparseTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { @@ -489,7 +489,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { for( int i = 9; i >= 0; i-- ) @@ -532,7 +532,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < 10; i++ ) m.setElement( i, i, i ); for( int i = 0; i < 10; i++ ) @@ -562,7 +562,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 1 ]; IndexType columnIndexes[ 1 ]; @@ -593,7 +593,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) @@ -647,7 +647,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; IndexType columnIndexes[ 10 ]; @@ -673,7 +673,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) { for( int j = 9; j >= 0; j-- ) @@ -694,7 +694,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; IndexType columnIndexes[ 10 ]; @@ -743,7 +743,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { @@ -788,7 +788,7 @@ class SparseTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; @@ -813,7 +813,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 9; i >= 0; i-- ) { for( int j = i; j >= 0; j-- ) @@ -838,7 +838,7 @@ class SparseTester : public CppUnit :: TestCase rowLengths.setSize( m.getRows() ); for( int i = 0; i < 10; i++ ) rowLengths.setElement( i, i+1 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); RealType values[ 10 ]; @@ -884,7 +884,7 @@ class SparseTester : public CppUnit :: TestCase m.reset(); m.setDimensions( 10, 10 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); if( std::is_same< DeviceType, Devices::Host >::value ) { @@ -936,7 +936,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( 7 ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { v.setElement( i, i ); @@ -960,7 +960,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( size ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { for( int j = 0; j < size; j++ ) @@ -985,7 +985,7 @@ class SparseTester : public CppUnit :: TestCase IndexVector rowLengths; rowLengths.setSize( m.getRows() ); rowLengths.setValue( size ); - m.setCompressedRowsLengths( rowLengths ); + m.setCompressedRowLengths( rowLengths ); for( int i = 0; i < size; i++ ) { for( int j = 0; j <= i; j++ ) diff --git a/tests/unit-tests/mesh/tnlGrid1DTester.h b/tests/unit-tests/mesh/tnlGrid1DTester.h index 6e56d5810deb6578f3369068199e47406c5d5e4a..c5d8c8a7377b292c07157e0d32d00cbe8b97eb3b 100644 --- a/tests/unit-tests/mesh/tnlGrid1DTester.h +++ b/tests/unit-tests/mesh/tnlGrid1DTester.h @@ -21,7 +21,7 @@ class GridTester< 1, RealType, Device, IndexType >: public CppUnit :: TestCase typedef typename CppUnit::TestCaller< TesterType > TestCallerType; typedef Meshes::Grid< 1, RealType, Device, IndexType > GridType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; GridTester(){}; @@ -42,7 +42,7 @@ class GridTester< 1, RealType, Device, IndexType >: public CppUnit :: TestCase void setDomainTest() { GridType grid; - grid.setDomain( VertexType( 0.0 ), VertexType( 1.0 ) ); + grid.setDomain( PointType( 0.0 ), PointType( 1.0 ) ); grid.setDimensions( 10 ); CPPUNIT_ASSERT( grid.getSpaceSteps().x() == 0.1 ); @@ -71,14 +71,14 @@ class GridTester< 1, RealType, Device, IndexType >: public CppUnit :: TestCase GridType grid; grid.setDimensions( xSize ); - typename GridType::Vertex vertex( grid ); + typename GridType::Point vertex( grid ); for( vertex.getCoordinates().x() = 0; vertex.getCoordinates().x() < xSize; vertex.getCoordinates().x()++ ) { CPPUNIT_ASSERT( grid.getEntityIndex( vertex ) >= 0 ); - CPPUNIT_ASSERT( grid.getEntityIndex( vertex ) < grid.template getEntitiesCount< typename GridType::Vertex >() ); - CPPUNIT_ASSERT( grid.template getEntity< typename GridType::Vertex >( grid.getEntityIndex( vertex ) ).getCoordinates() == vertex.getCoordinates() ); + CPPUNIT_ASSERT( grid.getEntityIndex( vertex ) < grid.template getEntitiesCount< typename GridType::Point >() ); + CPPUNIT_ASSERT( grid.template getEntity< typename GridType::Point >( grid.getEntityIndex( vertex ) ).getCoordinates() == vertex.getCoordinates() ); } } diff --git a/tests/unit-tests/mesh/tnlGrid2DTester.h b/tests/unit-tests/mesh/tnlGrid2DTester.h index c80d92115d5581bc382df65f4d005ac238dcbc82..fcb9b47131f90684d0538d0d67a3842073ca1dd3 100644 --- a/tests/unit-tests/mesh/tnlGrid2DTester.h +++ b/tests/unit-tests/mesh/tnlGrid2DTester.h @@ -21,7 +21,7 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase typedef typename CppUnit::TestCaller< TesterType > TestCallerType; typedef Meshes::Grid< 2, RealType, Device, IndexType > GridType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; GridTester(){}; @@ -48,7 +48,7 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase void setDomainTest() { GridType grid; - grid.setDomain( VertexType( 0.0, 0.0 ), VertexType( 1.0, 1.0 ) ); + grid.setDomain( PointType( 0.0, 0.0 ), PointType( 1.0, 1.0 ) ); grid.setDimensions( 10, 20 ); CPPUNIT_ASSERT( grid.getSpaceSteps().x() == 0.1 ); @@ -130,9 +130,9 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase const IndexType ySize( 17 ); GridType grid; - typedef typename GridType::template MeshEntity< 0 > VertexType; - typedef typename VertexType::EntityBasisType BasisType; - VertexType vertex( grid ); + typedef typename GridType::template MeshEntity< 0 > PointType; + typedef typename PointType::EntityBasisType BasisType; + PointType vertex( grid ); CoordinatesType& vertexCoordinates = vertex.getCoordinates(); grid.setDimensions( xSize, ySize ); @@ -143,10 +143,10 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase vertex.getCoordinates().x() < xSize + 1; vertex.getCoordinates().x()++ ) { - const IndexType vertexIndex = grid.template getEntityIndex< typename GridType::Vertex >( vertex ); + const IndexType vertexIndex = grid.template getEntityIndex< typename GridType::Point >( vertex ); CPPUNIT_ASSERT( vertexIndex >= 0 ); - CPPUNIT_ASSERT( vertexIndex < grid.template getEntitiesCount< typename GridType::Vertex >() ); - CPPUNIT_ASSERT( grid.template getEntity< typename GridType::Vertex >( vertexIndex ).getCoordinates() == vertex.getCoordinates() ); + CPPUNIT_ASSERT( vertexIndex < grid.template getEntitiesCount< typename GridType::Point >() ); + CPPUNIT_ASSERT( grid.template getEntity< typename GridType::Point >( vertexIndex ).getCoordinates() == vertex.getCoordinates() ); } } @@ -174,29 +174,29 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase { const CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( -1, 0 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< -1, 0 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< -1, 0 >() ) ); } if( cell.getCoordinates().x() < xSize - 1 ) { const CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 1, 0 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 1, 0 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 1, 0 >() ) ); } if( cell.getCoordinates().y() > 0 ) { const CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 0, -1 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 0, -1 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 0, -1 >() ) ); } if( cell.getCoordinates().y() < ySize - 1 ) { const CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 0, 1 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 0, 1 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 0, 1 >() ) ); } } } @@ -224,35 +224,35 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase { //const IndexType cellIndex = grid.getEntityIndex( cell ); cell.refresh(); //setIndex( cellIndex ); - auto neighbourEntities = cell.template getNeighbourEntities< GridType::Face::entityDimensions >(); + auto neighborEntities = cell.template getNeighborEntities< GridType::Face::entityDimension >(); FaceType face1( grid, cell.getCoordinates(), EntityOrientationType( -1, 0 ), EntityBasisType( 0, 1 ) ); IndexType face1Index = grid.template getEntityIndex( face1 ); - CPPUNIT_ASSERT( ( face1Index == neighbourEntities.template getEntityIndex< -1, 0 >() ) ); + CPPUNIT_ASSERT( ( face1Index == neighborEntities.template getEntityIndex< -1, 0 >() ) ); FaceType face2( grid, cell.getCoordinates() + CoordinatesType( 1, 0 ), EntityOrientationType( 1, 0 ), EntityBasisType( 0, 1 ) ); IndexType face2Index = grid.template getEntityIndex( face2 ); - CPPUNIT_ASSERT( ( face2Index == neighbourEntities.template getEntityIndex< 1, 0 >() ) ); + CPPUNIT_ASSERT( ( face2Index == neighborEntities.template getEntityIndex< 1, 0 >() ) ); FaceType face3( grid, cell.getCoordinates(), EntityOrientationType( 0, -1 ), EntityBasisType( 1, 0 ) ); IndexType face3Index = grid.template getEntityIndex( face3 ); - CPPUNIT_ASSERT( ( face3Index == neighbourEntities.template getEntityIndex< 0, -1 >() ) ); + CPPUNIT_ASSERT( ( face3Index == neighborEntities.template getEntityIndex< 0, -1 >() ) ); FaceType face4( grid, cell.getCoordinates() + CoordinatesType( 0, 1 ), EntityOrientationType( 0, 1 ), EntityBasisType( 1, 0 ) ); IndexType face4Index = grid.template getEntityIndex( face4 ); - CPPUNIT_ASSERT( ( face4Index == neighbourEntities.template getEntityIndex< 0, 1 >() ) ); + CPPUNIT_ASSERT( ( face4Index == neighborEntities.template getEntityIndex< 0, 1 >() ) ); } } @@ -281,20 +281,20 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase face.setOrientation( EntityOrientationType( 1, 0 ) ); //const IndexType faceIndex = grid.getEntityIndex( face ); face.refresh(); //setIndex( faceIndex ); - auto neighbourCells = face.template getNeighbourEntities< GridType::Cell::entityDimensions >(); + auto neighborCells = face.template getNeighborEntities< GridType::Cell::entityDimension >(); if( face.getCoordinates().x() > 0 ) { CellType cell( grid, face.getCoordinates() + CoordinatesType( -1, 0 ) ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourCells.template getEntityIndex< -1, 0 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborCells.template getEntityIndex< -1, 0 >() ) ); } if( face.getCoordinates().x() < xSize ) { CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, 0 ) ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourCells.template getEntityIndex< 1, 0 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborCells.template getEntityIndex< 1, 0 >() ) ); } } if( face.getCoordinates().x() < xSize ) @@ -302,19 +302,19 @@ class GridTester< 2, RealType, Device, IndexType >: public CppUnit :: TestCase face.setOrientation( EntityOrientationType( 0, 1 ) ); //const IndexType faceIndex = grid.getEntityIndex( face ); face.refresh();//setIndex( faceIndex ); - auto neighbourCells = face.template getNeighbourEntities< GridType::Cell::entityDimensions >(); + auto neighborCells = face.template getNeighborEntities< GridType::Cell::entityDimension >(); if( face.getCoordinates().y() > 0 ) { CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, -1 ) ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourCells.template getEntityIndex< 0, -1 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborCells.template getEntityIndex< 0, -1 >() ) ); } if( face.getCoordinates().y() < ySize ) { CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, 0 ) ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourCells.template getEntityIndex< 0, 1 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborCells.template getEntityIndex< 0, 1 >() ) ); } } } diff --git a/tests/unit-tests/mesh/tnlGrid3DTester.h b/tests/unit-tests/mesh/tnlGrid3DTester.h index e6dd2249a7c118fca6251f17370153fd08ac5353..fed97012f5fcb2305e6ec0d3d582e7c6e8f98231 100644 --- a/tests/unit-tests/mesh/tnlGrid3DTester.h +++ b/tests/unit-tests/mesh/tnlGrid3DTester.h @@ -21,7 +21,7 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase typedef typename CppUnit::TestCaller< TesterType > TestCallerType; typedef Meshes::Grid< 3, RealType, Device, IndexType > GridType; typedef typename GridType::CoordinatesType CoordinatesType; - typedef typename GridType::VertexType VertexType; + typedef typename GridType::PointType PointType; GridTester(){}; @@ -50,7 +50,7 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase void setDomainTest() { GridType grid; - grid.setDomain( VertexType( 0.0, 0.0, 0.0 ), VertexType( 1.0, 1.0, 1.0 ) ); + grid.setDomain( PointType( 0.0, 0.0, 0.0 ), PointType( 1.0, 1.0, 1.0 ) ); grid.setDimensions( 10, 20, 40 ); CPPUNIT_ASSERT( grid.getSpaceSteps().x() == 0.1 ); @@ -241,10 +241,10 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase GridType grid; grid.setDimensions( xSize, ySize, zSize ); - typedef typename GridType::template MeshEntity< 0 > VertexType; - typedef typename VertexType::EntityOrientationType OrientationType; - typedef typename VertexType::EntityBasisType BasisType; - VertexType vertex( grid ); + typedef typename GridType::template MeshEntity< 0 > PointType; + typedef typename PointType::EntityOrientationType OrientationType; + typedef typename PointType::EntityBasisType BasisType; + PointType vertex( grid ); for( vertex.getCoordinates().z() = 0; vertex.getCoordinates().z() < zSize + 1; @@ -291,43 +291,43 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase { CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( -1, 0, 0 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< -1, 0, 0 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< -1, 0, 0 >() ) ); } if( cell.getCoordinates().x() < xSize - 1 ) { CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 1, 0, 0 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 1, 0, 0 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 1, 0, 0 >() ) ); } if( cell.getCoordinates().y() > 0 ) { CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 0, -1, 0 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 0, -1, 0 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 0, -1, 0 >() ) ); } if( cell.getCoordinates().y() < ySize - 1 ) { CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 0, 1, 0 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 0, 1, 0 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 0, 1, 0 >() ) ); } if( cell.getCoordinates().z() > 0 ) { CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 0, 0, -1 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 0, 0, -1 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 0, 0, -1 >() ) ); } if( cell.getCoordinates().z() < zSize - 1 ) { CellType auxCell( grid, cell.getCoordinates() + CoordinatesType( 0, 0, 1 ) ); const IndexType auxCellIndex = grid.getEntityIndex( auxCell ); - auto neighbourEntities = cell.getNeighbourEntities(); - CPPUNIT_ASSERT( ( auxCellIndex == neighbourEntities.template getEntityIndex< 0, 0, 1 >() ) ); + auto neighborEntities = cell.getNeighborEntities(); + CPPUNIT_ASSERT( ( auxCellIndex == neighborEntities.template getEntityIndex< 0, 0, 1 >() ) ); } } } @@ -357,44 +357,44 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase { //const IndexType cellIndex = grid.getEntityIndex( cell ); cell.refresh();//setIndex( cellIndex ); - auto neighbourEntities = cell.template getNeighbourEntities< GridType::Face::entityDimensions >(); + auto neighborEntities = cell.template getNeighborEntities< GridType::Face::entityDimension >(); face.setCoordinates( cell.getCoordinates() ); face.setOrientation( EntityOrientationType( 1, 0, 0 ) ); //CoordinatesType faceCoordinates( i, j, k ); IndexType faceIndex = grid.getEntityIndex( face ); - CPPUNIT_ASSERT( ( faceIndex == neighbourEntities.template getEntityIndex< -1, 0, 0 >() ) ); + CPPUNIT_ASSERT( ( faceIndex == neighborEntities.template getEntityIndex< -1, 0, 0 >() ) ); //faceCoordinates = CoordinatesType( i + 1, j, k ); face.setCoordinates( cell.getCoordinates() + CoordinatesType( 1, 0, 0 ) ); face.setOrientation( EntityOrientationType( 1, 0 , 0 ) ); faceIndex = grid.getEntityIndex( face ); - CPPUNIT_ASSERT( ( faceIndex == neighbourEntities.template getEntityIndex< 1, 0, 0 >() ) ); + CPPUNIT_ASSERT( ( faceIndex == neighborEntities.template getEntityIndex< 1, 0, 0 >() ) ); //faceCoordinates = CoordinatesType( i, j, k ); face.setCoordinates( cell.getCoordinates() ); face.setOrientation( EntityOrientationType( 0, -1, 0 ) ); faceIndex = grid.getEntityIndex( face ); - CPPUNIT_ASSERT( ( faceIndex == neighbourEntities.template getEntityIndex< 0, -1, 0 >() ) ); + CPPUNIT_ASSERT( ( faceIndex == neighborEntities.template getEntityIndex< 0, -1, 0 >() ) ); //faceCoordinates = CoordinatesType( i, j + 1, k ); face.setCoordinates( cell.getCoordinates() + CoordinatesType( 0, 1, 0 ) ); face.setOrientation( EntityOrientationType( 0, 1, 0 ) ); faceIndex = grid.getEntityIndex( face ); - CPPUNIT_ASSERT( ( faceIndex == neighbourEntities.template getEntityIndex< 0, 1, 0 >() ) ); + CPPUNIT_ASSERT( ( faceIndex == neighborEntities.template getEntityIndex< 0, 1, 0 >() ) ); //faceCoordinates = CoordinatesType( i, j, k ); face.setCoordinates( cell.getCoordinates() ); face.setOrientation( EntityOrientationType( 0, 0, -1 ) ); faceIndex = grid.getEntityIndex( face ); - CPPUNIT_ASSERT( ( faceIndex == neighbourEntities.template getEntityIndex< 0, 0, -1 >() ) ); + CPPUNIT_ASSERT( ( faceIndex == neighborEntities.template getEntityIndex< 0, 0, -1 >() ) ); //faceCoordinates = CoordinatesType( i, j, k + 1 ); face.setCoordinates( cell.getCoordinates() + CoordinatesType( 0, 0, 1 ) ); face.setOrientation( EntityOrientationType( 0, 0, 1 ) ); faceIndex = grid.getEntityIndex( face ); - CPPUNIT_ASSERT( ( faceIndex == neighbourEntities.template getEntityIndex< 0, 0, 1 >() ) ); + CPPUNIT_ASSERT( ( faceIndex == neighborEntities.template getEntityIndex< 0, 0, 1 >() ) ); } } @@ -428,20 +428,20 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase face.setOrientation( EntityOrientationType( 1, 0, 0 ) ); //const IndexType faceIndex = grid.getEntityIndex( face ); face.refresh();//setIndex( faceIndex ); - auto neighbourEntities = face.template getNeighbourEntities< GridType::Cell::entityDimensions >(); + auto neighborEntities = face.template getNeighborEntities< GridType::Cell::entityDimension >(); if( face.getCoordinates().x() > 0 ) { CellType cell( grid, face.getCoordinates() + CoordinatesType( -1, 0, 0 ) ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourEntities.template getEntityIndex< -1, 0, 0 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborEntities.template getEntityIndex< -1, 0, 0 >() ) ); } if( face.getCoordinates().x() < xSize ) { CellType cell( grid, face.getCoordinates() ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourEntities.template getEntityIndex< 1, 0, 0 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborEntities.template getEntityIndex< 1, 0, 0 >() ) ); } } if( face.getCoordinates().x() < xSize && face.getCoordinates().z() < zSize ) @@ -449,19 +449,19 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase face.setOrientation( EntityOrientationType( 0, 1, 0 ) ); //const IndexType faceIndex = grid.getEntityIndex( face ); face.refresh();//setIndex( faceIndex ); - auto neighbourEntities = face.template getNeighbourEntities< GridType::Cell::entityDimensions >(); + auto neighborEntities = face.template getNeighborEntities< GridType::Cell::entityDimension >(); if( face.getCoordinates().y() > 0 ) { CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, -1, 0 ) ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourEntities.template getEntityIndex< 0, -1, 0 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborEntities.template getEntityIndex< 0, -1, 0 >() ) ); } if( face.getCoordinates().y() < ySize ) { CellType cell( grid, face.getCoordinates() ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourEntities.template getEntityIndex< 0, 1, 0 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborEntities.template getEntityIndex< 0, 1, 0 >() ) ); } } if( face.getCoordinates().x() < xSize && face.getCoordinates().y() < ySize ) @@ -469,19 +469,19 @@ class GridTester< 3, RealType, Device, IndexType >: public CppUnit :: TestCase face.setOrientation( EntityOrientationType( 0, 0, 1 ) ); //const IndexType faceIndex = grid.getEntityIndex( face ); face.refresh();//setIndex( faceIndex ); - auto neighbourEntities = face.template getNeighbourEntities< GridType::Cell::entityDimensions >(); + auto neighborEntities = face.template getNeighborEntities< GridType::Cell::entityDimension >(); if( face.getCoordinates().z() > 0 ) { CellType cell( grid, face.getCoordinates() + CoordinatesType( 0, 0, -1 ) ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourEntities.template getEntityIndex< 0, 0, -1 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborEntities.template getEntityIndex< 0, 0, -1 >() ) ); } if( face.getCoordinates().z() < zSize ) { CellType cell( grid, face.getCoordinates() ); IndexType cellIndex = grid.getEntityIndex( cell ); - CPPUNIT_ASSERT( ( cellIndex == neighbourEntities.template getEntityIndex< 0, 0, 1 >() ) ); + CPPUNIT_ASSERT( ( cellIndex == neighborEntities.template getEntityIndex< 0, 0, 1 >() ) ); } } } diff --git a/tests/unit-tests/mesh/tnlGridTester.h b/tests/unit-tests/mesh/tnlGridTester.h index ed0bf311997508415bb7ce6ea19b7a2a05e280f0..da49138ad2d7b4989d37d7b1e5f5c01150119705 100644 --- a/tests/unit-tests/mesh/tnlGridTester.h +++ b/tests/unit-tests/mesh/tnlGridTester.h @@ -20,7 +20,7 @@ #include <TNL/Meshes/Grid.h> -template< int Dimensions, typename RealType, typename Device, typename IndexType > +template< int Dimension, typename RealType, typename Device, typename IndexType > class GridTester{}; #include "tnlGrid1DTester.h" diff --git a/tests/unit-tests/mesh/tnlMeshEntityTester.h b/tests/unit-tests/mesh/tnlMeshEntityTester.h index 0a9797dfc060378c20a2852b5565e86764b2177f..a62dd4eefeb73154a114a0491783cf2f9a6e300b 100644 --- a/tests/unit-tests/mesh/tnlMeshEntityTester.h +++ b/tests/unit-tests/mesh/tnlMeshEntityTester.h @@ -35,13 +35,13 @@ class TestTriangleMeshConfig : public MeshConfigBase< MeshTriangleTopology > public: template< typename MeshEntity > - static constexpr bool subentityStorage( MeshEntity entity, int subentityDimensions ) + static constexpr bool subentityStorage( MeshEntity entity, int subentityDimension ) { return true; } template< typename MeshEntity > - static constexpr bool superentityStorage( MeshEntity entity, int superentityDimensions ) + static constexpr bool superentityStorage( MeshEntity entity, int superentityDimension ) { return true; } @@ -52,13 +52,13 @@ class TestTetrahedronMeshConfig : public MeshConfigBase< MeshTetrahedronTopology public: template< typename MeshEntity > - static constexpr bool subentityStorage( MeshEntity entity, int subentityDimensions ) + static constexpr bool subentityStorage( MeshEntity entity, int subentityDimension ) { return true; } template< typename MeshEntity > - static constexpr bool superentityStorage( MeshEntity entity, int superentityDimensions ) + static constexpr bool superentityStorage( MeshEntity entity, int superentityDimension ) { return true; } diff --git a/tests/unit-tests/mesh/tnlMeshTester.h b/tests/unit-tests/mesh/tnlMeshTester.h index 9c5c72074d12b830867e25b6eb80f062fe0b4d28..39aaaf43d79776ecc2ae756ffa97005d0c45363f 100644 --- a/tests/unit-tests/mesh/tnlMeshTester.h +++ b/tests/unit-tests/mesh/tnlMeshTester.h @@ -37,9 +37,9 @@ class TestTriangleMeshConfig : public MeshConfigBase< MeshTriangleTopology > public: static constexpr bool entityStorage( int dimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimensions ) { return true; }; - //template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimensions ) { return true; }; + template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimension ) { return true; }; + //template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimension ) { return true; }; + template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimension ) { return true; }; }; class TestQuadrilateralMeshConfig : public MeshConfigBase< MeshQuadrilateralTopology > @@ -47,9 +47,9 @@ class TestQuadrilateralMeshConfig : public MeshConfigBase< MeshQuadrilateralTopo public: static constexpr bool entityStorage( int dimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) { return ( SubentityDimensions % 2 != 0 ); }; - template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimensions ) { return true; }; + template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimension ) { return true; }; + template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimension ) { return ( SubentityDimension % 2 != 0 ); }; + template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimension ) { return true; }; }; class TestTetrahedronMeshConfig : public MeshConfigBase< MeshTetrahedronTopology > @@ -57,9 +57,9 @@ class TestTetrahedronMeshConfig : public MeshConfigBase< MeshTetrahedronTopology public: static constexpr bool entityStorage( int dimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) { return ( SubentityDimensions % 2 != 0 ); }; - template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimensions ) { return true; }; + template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimension ) { return true; }; + template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimension ) { return ( SubentityDimension % 2 != 0 ); }; + template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimension ) { return true; }; }; class TestHexahedronMeshConfig : public MeshConfigBase< MeshHexahedronTopology > @@ -67,9 +67,9 @@ class TestHexahedronMeshConfig : public MeshConfigBase< MeshHexahedronTopology > public: static constexpr bool entityStorage( int dimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimensions ) { return true; }; - template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) { return ( SubentityDimensions % 2 != 0 ); }; - template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimensions ) { return true; }; + template< typename MeshEntity > static constexpr bool subentityStorage( MeshEntity, int SubentityDimension ) { return true; }; + template< typename MeshEntity > static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimension ) { return ( SubentityDimension % 2 != 0 ); }; + template< typename MeshEntity > static constexpr bool superentityStorage( MeshEntity, int SuperentityDimension ) { return true; }; }; template< typename RealType, typename Device, typename IndexType > diff --git a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h index 0416a13739a174cc34b98680af4a455d10804ae1..5d7c110553e2c528944b4c2256624ef69347a80b 100644 --- a/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h +++ b/tests/unit-tests/operators/diffusion/tnlLinearDiffusionTest.h @@ -67,8 +67,8 @@ class LinearDiffusionTest void runUnitTest() { RealType coarseErrors[ 3 ], fineErrors[ 3 ]; - this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors ); - this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors ); + this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimension() - 1 ], coarseErrors ); + this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimension() - 1 ], fineErrors ); this->checkEoc( coarseErrors, fineErrors, eoc, tolerance, verbose ); } @@ -103,7 +103,7 @@ template< typename Mesh, bool verbose > bool setTestFunction() { - return runTest< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimensions(), double >, write, verbose >(); + return runTest< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimension(), double >, write, verbose >(); } template< typename Device, diff --git a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h index 42e24d21df3ab0700d12d95df2432df93d6a9545..b86372509e4dd4d233ff5f30f0da69ab5d3917c0 100644 --- a/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h +++ b/tests/unit-tests/operators/diffusion/tnlOneSidedMeanCurvatureTest.h @@ -73,8 +73,8 @@ class OneSidedMeanCurvatureTest void runUnitTest() { RealType coarseErrors[ 3 ], fineErrors[ 3 ]; - this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors ); - this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors ); + this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimension() - 1 ], coarseErrors ); + this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimension() - 1 ], fineErrors ); this->checkEoc( coarseErrors, fineErrors, eoc, tolerance, verbose ); } @@ -109,7 +109,7 @@ template< typename Mesh, bool verbose > bool setTestFunction() { - return runTest< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimensions(), double >, write, verbose >(); + return runTest< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimension(), double >, write, verbose >(); } template< typename Device, diff --git a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h index b5cb4817da17090f55cd537142d2aab4493322c1..7e401899a67fd9be56acdaef120888b0528e2721 100644 --- a/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h +++ b/tests/unit-tests/operators/fdm/tnlFiniteDifferencesTest.h @@ -97,8 +97,8 @@ class tnlFiniteDifferenceTest void runUnitTest() { RealType coarseErrors[ 3 ], fineErrors[ 3 ]; - this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors ); - this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors ); + this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimension() - 1 ], coarseErrors ); + this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimension() - 1 ], fineErrors ); this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose ); } @@ -160,8 +160,8 @@ template< typename Mesh, bool Verbose > bool setFunction() { - const int Dimensions = Mesh::meshDimensions; - typedef Functions::Analytic::ExpBump< Dimensions, RealType > Function; + const int Dimension = Mesh::meshDimension; + typedef Functions::Analytic::ExpBump< Dimension, RealType > Function; return setFiniteDifferenceOperator< Mesh, Function, RealType, IndexType, XDifference, YDifference, ZDifference, MeshSize, WriteFunctions, Verbose >(); } diff --git a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h index 0553b6df2812db2318d03d5dfd2ff4c45ec9b119..9b84c08fc310c7e525dffc08fefd0f68f14d292f 100644 --- a/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h +++ b/tests/unit-tests/operators/geometric/tnlCoFVMGradientNormTest.h @@ -75,8 +75,8 @@ class CoFVMGradientNormTest void runUnitTest() { RealType coarseErrors[ 3 ], fineErrors[ 3 ]; - this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors ); - this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors ); + this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimension() - 1 ], coarseErrors ); + this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimension() - 1 ], fineErrors ); this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose ); } @@ -115,7 +115,7 @@ template< typename Mesh, bool verbose > bool setTestFunction() { - return setDifferenceOperator< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimensions(), double >, write, verbose >(); + return setDifferenceOperator< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimension(), double >, write, verbose >(); } template< typename Device, diff --git a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h index 1be915a7cb9058d7104698cb35d42d1379846d8c..7a47af33c8ea42da3ef977dfbb7a659c2c3265d5 100644 --- a/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h +++ b/tests/unit-tests/operators/geometric/tnlFDMGradientNormTest.h @@ -89,8 +89,8 @@ class FDMGradientNormTest void runUnitTest() { RealType coarseErrors[ 3 ], fineErrors[ 3 ]; - this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors ); - this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors ); + this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimension() - 1 ], coarseErrors ); + this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimension() - 1 ], fineErrors ); this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose ); } @@ -135,7 +135,7 @@ template< typename Mesh, bool verbose > bool setTestFunction() { - return setDifferenceOperator< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimensions(), double >, write, verbose >(); + return setDifferenceOperator< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimension(), double >, write, verbose >(); } template< typename Device, diff --git a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h index 045daa55f7604363fa7a3880525b3bbf9dc722ef..d32193ccffb45d79cab4dd5d4be58f4ab9538262 100644 --- a/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h +++ b/tests/unit-tests/operators/geometric/tnlTwoSidedGradientNormTest.h @@ -66,8 +66,8 @@ class TwoSidedGradientNormTest void runUnitTest() { RealType coarseErrors[ 3 ], fineErrors[ 3 ]; - this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], coarseErrors ); - this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimensions() - 1 ], fineErrors ); + this->getApproximationError( coarseMeshSize[ MeshType::getMeshDimension() - 1 ], coarseErrors ); + this->getApproximationError( 2 * coarseMeshSize[ MeshType::getMeshDimension() - 1 ], fineErrors ); this->checkEoc( coarseErrors, fineErrors, this->eoc, this->tolerance, verbose ); } @@ -109,7 +109,7 @@ template< typename Mesh, bool verbose > bool setTestFunction() { - return setDifferenceOperator< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimensions(), double >, write, verbose >(); + return setDifferenceOperator< Mesh, Functions::Analytic::ExpBump< Mesh::getMeshDimension(), double >, write, verbose >(); } template< typename Device, diff --git a/tests/unit-tests/operators/tnlApproximationError.h b/tests/unit-tests/operators/tnlApproximationError.h index a61f5128ffbe3da8c8b3ab047ba0cb93f9d0511c..fcbf8404275f9be76d78fb4f3b9ef574dce3e46f 100644 --- a/tests/unit-tests/operators/tnlApproximationError.h +++ b/tests/unit-tests/operators/tnlApproximationError.h @@ -33,9 +33,9 @@ class tnlApproximationError typedef typename ApproximateOperator::MeshType MeshType; typedef typename MeshType::DeviceType DeviceType; typedef typename MeshType::IndexType IndexType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; typedef SharedPointer< MeshType > MeshPointer; - typedef Functions::Analytic::Constant< MeshType::meshDimensions, RealType > ConstantType; + typedef Functions::Analytic::Constant< MeshType::meshDimension, RealType > ConstantType; typedef Operators::DirichletBoundaryConditions< MeshType, Function > BoundaryConditionsType; static void getError( const ExactOperator& exactOperator, @@ -48,7 +48,7 @@ class tnlApproximationError bool writeFunctions ) { typedef Functions::MeshFunction< MeshType, MeshEntity::getDimensions() > MeshFunction; - typedef Operators::DirichletBoundaryConditions< MeshType, Functions::Analytic::Constant< MeshType::meshDimensions > > DirichletBoundaryConditions; + typedef Operators::DirichletBoundaryConditions< MeshType, Functions::Analytic::Constant< MeshType::meshDimension > > DirichletBoundaryConditions; typedef Functions::OperatorFunction< DirichletBoundaryConditions, MeshFunction > BoundaryOperatorFunction; typedef Functions::OperatorFunction< ApproximateOperator, MeshFunction > OperatorFunction; typedef Functions::ExactOperatorFunction< ExactOperator, Function > ExactOperatorFunction; @@ -61,11 +61,11 @@ class tnlApproximationError String meshSizeString( meshPointer->getDimensions().x() ); String dimensionsString; - if( MeshType::getMeshDimensions() == 1 ) + if( MeshType::getMeshDimension() == 1 ) dimensionsString = "1D-"; - if( MeshType::getMeshDimensions() == 2 ) + if( MeshType::getMeshDimension() == 2 ) dimensionsString = "2D-"; - if( MeshType::getMeshDimensions() == 3 ) + if( MeshType::getMeshDimension() == 3 ) dimensionsString = "3D-"; //if( writeFunctions ) @@ -117,8 +117,8 @@ class tnlApproximationError< Mesh, ExactOperator, ApproximateOperator, Function, typedef Mesh MeshType; typedef typename MeshType::DeviceType DeviceType; typedef typename MeshType::IndexType IndexType; - typedef typename MeshType::VertexType VertexType; - typedef Constant< MeshType::meshDimensions, RealType > ConstantType; + typedef typename MeshType::PointType PointType; + typedef Constant< MeshType::meshDimension, RealType > ConstantType; typedef DirichletBoundaryConditions< MeshType, Function > BoundaryConditionsType; static void getError( const Mesh& mesh, diff --git a/tests/unit-tests/operators/tnlOperatorCompositionTest.h b/tests/unit-tests/operators/tnlOperatorCompositionTest.h index f872c323ff75c828e527ff82df5ce791231c51d3..0a380191e4ac0c5806eedbc8e60a4ad846c83960 100644 --- a/tests/unit-tests/operators/tnlOperatorCompositionTest.h +++ b/tests/unit-tests/operators/tnlOperatorCompositionTest.h @@ -40,12 +40,12 @@ class OperatorCompositionTest typedef typename OperatorType::RealType RealType; typedef typename OperatorType::IndexType IndexType; typedef typename MeshType::CoordinatesType CoordinatesType; - typedef typename MeshType::VertexType VertexType; - typedef Functions::Analytic::ExpBump< MeshType::getMeshDimensions(), typename MeshType::RealType > TestFunctionType; - typedef Functions::Analytic::Constant< MeshType::getMeshDimensions(), typename MeshType::RealType > Constant; + typedef typename MeshType::PointType PointType; + typedef Functions::Analytic::ExpBump< MeshType::getMeshDimension(), typename MeshType::RealType > TestFunctionType; + typedef Functions::Analytic::Constant< MeshType::getMeshDimension(), typename MeshType::RealType > Constant; typedef Operators::NeumannBoundaryConditions< MeshType, Constant > BoundaryConditions; typedef Operators::OperatorComposition< OperatorType, OperatorType, BoundaryConditions > OperatorComposition; - typedef Functions::MeshFunction< MeshType, MeshType::getMeshDimensions() > MeshFunctionType; + typedef Functions::MeshFunction< MeshType, MeshType::getMeshDimension() > MeshFunctionType; typedef Functions::OperatorFunction< OperatorType, MeshFunctionType, BoundaryConditions > OperatorFunction; typedef Functions::OperatorFunction< OperatorType, OperatorFunction, BoundaryConditions > OperatorFunction2; @@ -67,7 +67,7 @@ class OperatorCompositionTest { SharedPointer< MeshType > mesh; mesh->setDimensions( CoordinatesType( 25 ) ); - mesh->setDomain( VertexType( -1.0 ), VertexType( 2.0 ) ); + mesh->setDomain( PointType( -1.0 ), PointType( 2.0 ) ); TestFunctionType testFunction; testFunction.setAmplitude( 1.0 ); testFunction.setSigma( 1.0 ); diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h b/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h index d7e733892c999db690a627070799f51c36db23cf..6a540aa61dfbf55d0e3014ed46cecb139043eea3 100644 --- a/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h +++ b/tests/unit-tests/operators/tnlPDEOperatorEocTestFunctionSetter.h @@ -20,15 +20,15 @@ class tnlPDEOperatorEocTestFunctionSetter { }; -template< int Dimensions, +template< int Dimension, typename Real > -class tnlPDEOperatorEocTestFunctionSetter< Functions::Analytic::ExpBump< Dimensions, Real > > +class tnlPDEOperatorEocTestFunctionSetter< Functions::Analytic::ExpBump< Dimension, Real > > { - static_assert( Dimensions >= 0 && Dimensions <= 3, - "Wrong parameter Dimensions." ); + static_assert( Dimension >= 0 && Dimension <= 3, + "Wrong parameter Dimension." ); public: - typedef Functions::Analytic::ExpBump< Dimensions, Real > FunctionType; + typedef Functions::Analytic::ExpBump< Dimension, Real > FunctionType; static void setup( FunctionType& function ) { diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h b/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h index 9f983e5483c82d0cdb1fc7accdcebb1a3b93a234..4c96be678bd5372772346d8db77e5ae70157a7dd 100644 --- a/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h +++ b/tests/unit-tests/operators/tnlPDEOperatorEocTestMeshSetter.h @@ -28,7 +28,7 @@ class tnlPDEOperatorEocTestMeshSetter< Meshes::Grid< 1, Real, Device, Index > > public: typedef Meshes::Grid< 1, Real, Device, Index > MeshType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef Real RealType; typedef Device DeviceType; @@ -36,7 +36,7 @@ class tnlPDEOperatorEocTestMeshSetter< Meshes::Grid< 1, Real, Device, Index > > static bool setup( MeshType& mesh, const IndexType meshSize ) { - VertexType origin, proportions; + PointType origin, proportions; origin.x() = -2.0; proportions.x() = 4.0; mesh.setDomain( origin, proportions ); @@ -57,7 +57,7 @@ class tnlPDEOperatorEocTestMeshSetter< Meshes::Grid< 2, Real, Device, Index > > public: typedef Meshes::Grid< 2, Real, Device, Index > MeshType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef Real RealType; typedef Device DeviceType; @@ -65,7 +65,7 @@ class tnlPDEOperatorEocTestMeshSetter< Meshes::Grid< 2, Real, Device, Index > > static bool setup( MeshType& mesh, const IndexType meshSize ) { - VertexType origin, proportions; + PointType origin, proportions; origin.x() = -1.0; origin.y() = -1.0; proportions.x() = 2.0; @@ -89,7 +89,7 @@ class tnlPDEOperatorEocTestMeshSetter< Meshes::Grid< 3, Real, Device, Index > > public: typedef Meshes::Grid< 3, Real, Device, Index > MeshType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef Real RealType; typedef Device DeviceType; @@ -97,7 +97,7 @@ class tnlPDEOperatorEocTestMeshSetter< Meshes::Grid< 3, Real, Device, Index > > static bool setup( MeshType& mesh, const IndexType meshSize ) { - VertexType origin, proportions; + PointType origin, proportions; origin.x() = -1.0; origin.y() = -1.0; origin.z() = -1.0; diff --git a/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h b/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h index f6d37712a172528ce33d17d58a9aa254e66d30e8..fea04bbe33de7b1eba90fc06e73a1eab971ff17b 100644 --- a/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h +++ b/tests/unit-tests/operators/tnlPDEOperatorEocTestSetter.h @@ -41,14 +41,14 @@ class tnlPDEOperatorEocTestSetter< ApproximateOperator, typedef Meshes::Grid< 1, Real, Device, Index > MeshType; typedef ExactOperator ExactOperatorType; typedef ApproximateOperator ApproximateOperatorType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef ExpBump< 1, Real > FunctionType; static void setMesh( MeshType& mesh, const IndexType& size ) { - VertexType origin, proportions; + PointType origin, proportions; origin.x() = -2.0; proportions.x() = 4.0; mesh.setDomain( origin, proportions ); @@ -82,14 +82,14 @@ class tnlPDEOperatorEocTestSetter< ApproximateOperator, typedef Meshes::Grid< 2, Real, Device, Index > MeshType; typedef ExactOperator ExactOperatorType; typedef ApproximateOperator ApproximateOperatorType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef ExpBump< 2, Real > FunctionType; static void setMesh( MeshType& mesh, const IndexType& size ) { - VertexType origin, proportions; + PointType origin, proportions; origin.x() = -1.0; origin.y() = -1.0; proportions.x() = 2.0; @@ -126,14 +126,14 @@ class tnlPDEOperatorEocTestSetter< ApproximateOperator, typedef Meshes::Grid< 3, Real, Device, Index > MeshType; typedef ExactOperator ExactOperatorType; typedef ApproximateOperator ApproximateOperatorType; - typedef typename MeshType::VertexType VertexType; + typedef typename MeshType::PointType PointType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef ExpBump< 3, Real > FunctionType; static void setMesh( MeshType& mesh, const IndexType& size ) { - VertexType origin, proportions; + PointType origin, proportions; origin.x() = -1.0; origin.y() = -1.0; origin.z() = -1.0;