diff --git a/src/TNL/CMakeLists.txt b/src/TNL/CMakeLists.txt index 13113f9c3fa6b04c3e485eb836e149f48a1c91d7..c197389da57fc292d129d31abac73d97b1967feb 100644 --- a/src/TNL/CMakeLists.txt +++ b/src/TNL/CMakeLists.txt @@ -40,6 +40,7 @@ set( headers StaticFor.h String.h Timer.h + terminal-colors.h UniquePointer.h ) set( common_SOURCES diff --git a/src/TNL/Communicators/MpiCommunicator.h b/src/TNL/Communicators/MpiCommunicator.h index cbfb1e6a5a2e70b71332cf10dbd757194e9b0f82..8dbff7909778ae2c40bddd6a7382ba4ef9490df6 100644 --- a/src/TNL/Communicators/MpiCommunicator.h +++ b/src/TNL/Communicators/MpiCommunicator.h @@ -66,7 +66,7 @@ class MpiCommunicator static bool isDistributed() { return GetSize(AllGroup)>1; - }; + } static void configSetup( Config::ConfigDescription& config, const String& prefix = "" ) { @@ -125,7 +125,7 @@ class MpiCommunicator } } #endif - }; + } static void Finalize() { @@ -140,7 +140,7 @@ class MpiCommunicator } MPI_Finalize(); #endif - }; + } static bool IsInitialized() { @@ -152,7 +152,7 @@ class MpiCommunicator #else return false; #endif - }; + } static int GetRank(CommunicationGroup group) { @@ -164,7 +164,7 @@ class MpiCommunicator #else return 1; #endif - }; + } static int GetSize(CommunicationGroup group) { @@ -176,7 +176,7 @@ class MpiCommunicator #else return 1; #endif - }; + } //dim-number of dimesions, distr array of guess distr - 0 for computation //distr array will be filled by computed distribution @@ -201,7 +201,7 @@ class MpiCommunicator MPI_Dims_create(nproc, dim, distr); #endif - }; + } static void Barrier(CommunicationGroup comm) { @@ -211,7 +211,7 @@ class MpiCommunicator #else throw Exceptions::MPISupportMissing(); #endif - }; + } template <typename T> static Request ISend( const T *data, int count, int dest, CommunicationGroup group) @@ -247,7 +247,7 @@ class MpiCommunicator #else throw Exceptions::MPISupportMissing(); #endif - }; + } template< typename T > static void Bcast( T& data, int count, int root,CommunicationGroup group) @@ -272,7 +272,7 @@ class MpiCommunicator #else throw Exceptions::MPISupportMissing(); #endif - }; + } template< typename T > @@ -288,7 +288,7 @@ class MpiCommunicator #else throw Exceptions::MPISupportMissing(); #endif - }; + } static void writeProlog( Logger& logger ) diff --git a/src/TNL/Communicators/NoDistrCommunicator.h b/src/TNL/Communicators/NoDistrCommunicator.h index 43c83a42974003d03f009f58e9aaff683d6f5fc1..46613a29c9a446c8dfea29d15dfad4b7cc039a84 100644 --- a/src/TNL/Communicators/NoDistrCommunicator.h +++ b/src/TNL/Communicators/NoDistrCommunicator.h @@ -53,22 +53,22 @@ class NoDistrCommunicator static bool IsInitialized() { return true; - }; + } static bool isDistributed() { return false; - }; + } static int GetRank(CommunicationGroup group) { return 0; - }; + } static int GetSize(CommunicationGroup group) { return 1; - }; + } static void DimsCreate(int nproc, int dim, int *distr) { @@ -76,7 +76,7 @@ class NoDistrCommunicator { distr[i]=1; } - }; + } static void Barrier(CommunicationGroup group) { @@ -96,7 +96,7 @@ class NoDistrCommunicator static void WaitAll(Request *reqs, int length) { - }; + } template< typename T > static void Bcast( T& data, int count, int root, CommunicationGroup group) @@ -111,7 +111,7 @@ class NoDistrCommunicator CommunicationGroup group ) { memcpy( ( void* ) reduced_data, ( void* ) data, count * sizeof( T ) ); - }; + } template< typename T > static void Reduce( T* data, @@ -122,7 +122,7 @@ class NoDistrCommunicator CommunicationGroup group ) { memcpy( ( void* ) reduced_data, ( void* ) data, count * sizeof( T ) ); - }; + } static void writeProlog( Logger& logger ){}; }; diff --git a/src/Tools/tnl-lattice-init.h b/src/Tools/tnl-lattice-init.h index e9b507aacf41873e1a3a1231c527a6557428b551..269ff5201d25567a2595a2fa17fe71745249a072 100644 --- a/src/Tools/tnl-lattice-init.h +++ b/src/Tools/tnl-lattice-init.h @@ -89,11 +89,16 @@ bool performExtrude( const Config::ParameterContainer& parameters, ProfilePointType aux2( rotationCos * aux1.x() - rotationSin * aux1.y(), rotationSin * aux1.x() + rotationCos * aux1.y() ); aux1 = profileCenter + aux2; - profileCell.getCoordinates().x() = aux1.x() / profileMesh.getSpaceSteps().x(); - profileCell.getCoordinates().y() = aux1.y() / profileMesh.getSpaceSteps().y(); - profileCell.refresh(); - RealType aux = profile( profileCell ); - if( aux ) f( cell ) = aux; + if( aux1.x() >= 0 && aux1.y() >= 0 && + aux1.x() <= profileMesh.getProportions().x() && + aux1.y() <= profileMesh.getProportions().y() ) + { + profileCell.getCoordinates().x() = aux1.x() / profileMesh.getSpaceSteps().x(); + profileCell.getCoordinates().y() = aux1.y() / profileMesh.getSpaceSteps().y(); + profileCell.refresh(); + RealType aux = profile( profileCell ); + if( aux ) f( cell ) = aux; + } } } if( profileOrientation == "y" ) @@ -114,11 +119,16 @@ bool performExtrude( const Config::ParameterContainer& parameters, ProfilePointType aux2( rotationCos * aux1.x() - rotationSin * aux1.y(), rotationSin * aux1.x() + rotationCos * aux1.y() ); aux1 = profileCenter + aux2; - profileCell.getCoordinates().x() = aux1.x() / profileMesh.getSpaceSteps().x(); - profileCell.getCoordinates().y() = aux1.y() / profileMesh.getSpaceSteps().y(); - profileCell.refresh(); - RealType aux = profile( profileCell ); - if( aux ) f( cell ) = aux; + if( aux1.x() >= 0 && aux1.y() >= 0 && + aux1.x() <= profileMesh.getProportions().x() && + aux1.y() <= profileMesh.getProportions().y() ) + { + profileCell.getCoordinates().x() = aux1.x() / profileMesh.getSpaceSteps().x(); + profileCell.getCoordinates().y() = aux1.y() / profileMesh.getSpaceSteps().y(); + profileCell.refresh(); + RealType aux = profile( profileCell ); + if( aux ) f( cell ) = aux; + } } } if( profileOrientation == "z" ) @@ -139,11 +149,16 @@ bool performExtrude( const Config::ParameterContainer& parameters, ProfilePointType aux2( rotationCos * aux1.x() - rotationSin * aux1.y(), rotationSin * aux1.x() + rotationCos * aux1.y() ); aux1 = profileCenter + aux2; - profileCell.getCoordinates().x() = aux1.x() / profileMesh.getSpaceSteps().x(); - profileCell.getCoordinates().y() = aux1.y() / profileMesh.getSpaceSteps().y(); - profileCell.refresh(); - RealType aux = profile( profileCell ); - if( aux ) f( cell ) = aux; + if( aux1.x() >= 0 && aux1.y() >= 0 && + aux1.x() <= profileMesh.getProportions().x() && + aux1.y() <= profileMesh.getProportions().y() ) + { + profileCell.getCoordinates().x() = aux1.x() / profileMesh.getSpaceSteps().x(); + profileCell.getCoordinates().y() = aux1.y() / profileMesh.getSpaceSteps().y(); + profileCell.refresh(); + RealType aux = profile( profileCell ); + if( aux ) f( cell ) = aux; + } } } }