Skip to content
Snippets Groups Projects
Commit cf35b44c authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Renamed Assert to TNL_ASSERT in meshes and multimaps

parent a162eaa6
No related branches found
No related tags found
No related merge requests found
......@@ -57,9 +57,9 @@ template< typename Element,
template<typename ArrayType>
void IndexedMap< Element, Index, Key >::toArray( ArrayType& array ) const
{
Assert( array.getSize() == getSize(),
std::cerr << "array.getSize() = " << array.getSize()
<< " getSize() = " << getSize() );
TNL_ASSERT( array.getSize() == getSize(),
std::cerr << "array.getSize() = " << array.getSize()
<< " getSize() = " << getSize() );
for( STDMapIteratorType iter = map.begin();
iter != map.end();
......
......@@ -44,7 +44,7 @@ EllpackIndexMultimapValues< Index, Device, LocalIndex >&
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator=( const EllpackIndexMultimapValues& other )
{
Assert( this->getSize() == other.getSize(), );
TNL_ASSERT( this->getSize() == other.getSize(), );
if( this->values != other.values ) {
for( LocalIndexType i = 0; i < this->getSize(); i++ )
this->setValue( i, other[ i ] );
......@@ -92,7 +92,7 @@ EllpackIndexMultimapValues( IndexType* values,
this->values = &values[ input * allocatedSize ];
this->valuesCount = &valuesCounts[ input ];
this->allocatedSize = allocatedSize;
Assert( *(this->valuesCount) <= allocatedSize, );
TNL_ASSERT( *(this->valuesCount) <= allocatedSize, );
}
template< typename Index,
......@@ -138,10 +138,10 @@ EllpackIndexMultimapValues< Index, Device, LocalIndex >::
setValue( const LocalIndexType& portIndex,
const IndexType& value )
{
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
this->values[ portIndex ] = value;
}
......@@ -152,10 +152,10 @@ Index
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
getValue( const LocalIndexType& portIndex ) const
{
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
return this->values[ portIndex ];
}
......@@ -166,10 +166,10 @@ Index&
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex )
{
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
return this->values[ portIndex ];
}
......@@ -180,10 +180,10 @@ const Index&
EllpackIndexMultimapValues< Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex ) const
{
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
return this->values[ portIndex ];
}
......
......@@ -56,7 +56,7 @@ void
EllpackIndexMultimap< Index, Device, LocalIndex >::
setKeysRange( const IndexType& keysRange )
{
Assert( keysRange >= 0, );
TNL_ASSERT( keysRange >= 0, );
this->keysRange = keysRange;
}
......@@ -77,7 +77,7 @@ bool
EllpackIndexMultimap< Index, Device, LocalIndex >::
allocate( const LocalIndexType& maxValuesCount )
{
Assert( maxValuesCount >= 0, );
TNL_ASSERT( maxValuesCount >= 0, );
this->maxValuesCount = maxValuesCount;
if( ! this->values.setSize( this->keysRange * this->maxValuesCount ) )
return false;
......@@ -94,14 +94,14 @@ bool
EllpackIndexMultimap< Index, Device, LocalIndex >::
allocate( const ValuesAllocationVectorType& valuesCounts )
{
Assert( valuesCounts.getSize() == this->keysRange,
std::cerr << "valuesCounts.getSize() = " << valuesCounts.getSize()
<< "this->keysRange = " << this->keysRange
<< std::endl; );
TNL_ASSERT( valuesCounts.getSize() == this->keysRange,
std::cerr << "valuesCounts.getSize() = " << valuesCounts.getSize()
<< "this->keysRange = " << this->keysRange
<< std::endl; );
this->maxValuesCount = valuesCounts.max();
Assert( this->maxValuesCount >= 0,
std::cerr << "this->maxValuesCount = " << this->maxValuesCount << std::endl; );
TNL_ASSERT( this->maxValuesCount >= 0,
std::cerr << "this->maxValuesCount = " << this->maxValuesCount << std::endl; );
if( ! this->values.setSize( this->keysRange * this->maxValuesCount ) )
return false;
if( ! this->valuesCounts.setSize( this->keysRange ) )
......@@ -117,16 +117,16 @@ typename EllpackIndexMultimap< Index, Device, LocalIndex >::ValuesAccessorType
EllpackIndexMultimap< Index, Device, LocalIndex >::
getValues( const IndexType& inputIndex )
{
Assert( inputIndex < this->getKeysRange(),
std::cerr << "inputIndex = " << inputIndex << std::endl
<< "this->getKeysRange() = " << this->getKeysRange()
<< std::endl; );
Assert( this->getKeysRange() * this->maxValuesCount == this->values.getSize() && this->getKeysRange() == this->valuesCounts.getSize(),
std::cerr << "The map has not been reallocated after calling setKeysRange()." << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl
<< "this->maxValuesCount = " << this->maxValuesCount << std::endl
<< "this->values.getSize() = " << this->values.getSize() << std::endl
<< "this->valuesCounts.getSize() = " << this->valuesCounts.getSize() << std::endl; );
TNL_ASSERT( inputIndex < this->getKeysRange(),
std::cerr << "inputIndex = " << inputIndex << std::endl
<< "this->getKeysRange() = " << this->getKeysRange()
<< std::endl; );
TNL_ASSERT( this->getKeysRange() * this->maxValuesCount == this->values.getSize() && this->getKeysRange() == this->valuesCounts.getSize(),
std::cerr << "The map has not been reallocated after calling setKeysRange()." << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl
<< "this->maxValuesCount = " << this->maxValuesCount << std::endl
<< "this->values.getSize() = " << this->values.getSize() << std::endl
<< "this->valuesCounts.getSize() = " << this->valuesCounts.getSize() << std::endl; );
return ValuesAccessorType( this->values.getData(), this->valuesCounts.getData(), inputIndex, this->maxValuesCount );
}
......@@ -137,11 +137,11 @@ typename EllpackIndexMultimap< Index, Device, LocalIndex >::ConstValuesAccessorT
EllpackIndexMultimap< Index, Device, LocalIndex >::
getValues( const IndexType& inputIndex ) const
{
Assert( inputIndex < this->getKeysRange(),
TNL_ASSERT( inputIndex < this->getKeysRange(),
std::cerr << "inputIndex = " << inputIndex << std::endl
<< "this->getKeysRange() = " << this->getKeysRange()
<< std::endl; );
Assert( this->getKeysRange() * this->maxValuesCount == this->values.getSize() && this->getKeysRange() == this->valuesCounts.getSize(),
TNL_ASSERT( this->getKeysRange() * this->maxValuesCount == this->values.getSize() && this->getKeysRange() == this->valuesCounts.getSize(),
std::cerr << "The map has not been reallocated after calling setKeysRange()." << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl
<< "this->maxValuesCount = " << this->maxValuesCount << std::endl
......
......@@ -118,12 +118,12 @@ StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
setValue( const LocalIndexType& portIndex,
const IndexType& value )
{
Assert( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
this->values[ portIndex ] = value;
}
......@@ -135,12 +135,12 @@ Index
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
getValue( const LocalIndexType& portIndex ) const
{
Assert( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
return this->values[ portIndex ];
}
......@@ -152,12 +152,12 @@ Index&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex )
{
Assert( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
return this->values[ portIndex ];
}
......@@ -169,12 +169,12 @@ const Index&
StaticEllpackIndexMultimapValues< ValuesCount, Index, Device, LocalIndex >::
operator[]( const LocalIndexType& portIndex ) const
{
Assert( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
Assert( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
TNL_ASSERT( this->values,
std::cerr << "This instance is not bound to any multimap." << std::endl; );
TNL_ASSERT( portIndex < this->getSize(),
std::cerr << " portIndex = " << portIndex
<< " getSize() = " << this->getSize()
<< std::endl );
return this->values[ portIndex ];
}
......
......@@ -60,7 +60,7 @@ void
StaticEllpackIndexMultimap< ValuesCount, Index, Device, LocalIndex >::
setKeysRange( const IndexType& keysRange )
{
Assert( keysRange >= 0, );
TNL_ASSERT( keysRange >= 0, );
this->keysRange = keysRange;
}
......@@ -94,13 +94,13 @@ typename StaticEllpackIndexMultimap< ValuesCount, Index, Device, LocalIndex >::V
StaticEllpackIndexMultimap< ValuesCount, Index, Device, LocalIndex >::
getValues( const IndexType& inputIndex )
{
Assert( inputIndex < this->getKeysRange(),
std::cerr << "inputIndex = " << inputIndex << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl; );
Assert( this->getKeysRange() * ValuesCount == this->values.getSize(),
std::cerr << "The map has not been reallocated after calling setKeysRange()." << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl
<< "this->values.getSize() = " << this->values.getSize() << std::endl; );
TNL_ASSERT( inputIndex < this->getKeysRange(),
std::cerr << "inputIndex = " << inputIndex << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl; );
TNL_ASSERT( this->getKeysRange() * ValuesCount == this->values.getSize(),
std::cerr << "The map has not been reallocated after calling setKeysRange()." << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl
<< "this->values.getSize() = " << this->values.getSize() << std::endl; );
return ValuesAccessorType( this->values.getData(), inputIndex );
}
......@@ -112,13 +112,13 @@ typename StaticEllpackIndexMultimap< ValuesCount, Index, Device, LocalIndex >::C
StaticEllpackIndexMultimap< ValuesCount, Index, Device, LocalIndex >::
getValues( const IndexType& inputIndex ) const
{
Assert( inputIndex < this->getKeysRange(),
std::cerr << "inputIndex = " << inputIndex << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl; );
Assert( this->getKeysRange() * ValuesCount == this->values.getSize(),
std::cerr << "The map has not been reallocated after calling setKeysRange()." << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl
<< "this->values.getSize() = " << this->values.getSize() << std::endl; );
TNL_ASSERT( inputIndex < this->getKeysRange(),
std::cerr << "inputIndex = " << inputIndex << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl; );
TNL_ASSERT( this->getKeysRange() * ValuesCount == this->values.getSize(),
std::cerr << "The map has not been reallocated after calling setKeysRange()." << std::endl
<< "this->getKeysRange() = " << this->getKeysRange() << std::endl
<< "this->values.getSize() = " << this->values.getSize() << std::endl; );
return ConstValuesAccessorType( this->values.getData(), inputIndex );
}
......
......@@ -16,7 +16,6 @@
#pragma once
#include <TNL/Assert.h>
#include <TNL/Meshes/Topologies/MeshEntityTopology.h>
#include <TNL/Meshes/DimensionTag.h>
......
......@@ -84,8 +84,8 @@ class MeshEntitySeed< MeshConfig, MeshVertexTopology >
void setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
{
Assert( cornerIndex == 0, std::cerr << "cornerIndex = " << cornerIndex );
Assert( 0 <= pointIndex, std::cerr << "pointIndex = " << pointIndex );
TNL_ASSERT( cornerIndex == 0, std::cerr << "cornerIndex = " << cornerIndex );
TNL_ASSERT( 0 <= pointIndex, std::cerr << "pointIndex = " << pointIndex );
this->cornerIds[ cornerIndex ] = pointIndex;
}
......
......@@ -48,25 +48,25 @@ public:
{
//std::cout << "Adding superentity with " << SuperdimensionTag::value << " dimension of entity with " << SubdimensionTag::value << " dimension: entityIndex = " << entityIndex << ", superentityIndex = " << superentityIndex << std::endl;
auto& indexSet = this->dynamicStorageNetwork[ entityIndex ];
Assert( indexSet.count( superentityIndex ) == 0,
std::cerr << "Superentity " << superentityIndex << " with dimension " << SuperdimensionTag::value
<< " of entity " << entityIndex << " with dimension " << SubdimensionTag::value
<< " has been already added. This is probably a bug in the mesh initializer." << std::endl; );
TNL_ASSERT( indexSet.count( superentityIndex ) == 0,
std::cerr << "Superentity " << superentityIndex << " with dimension " << SuperdimensionTag::value
<< " of entity " << entityIndex << " with dimension " << SubdimensionTag::value
<< " has been already added. This is probably a bug in the mesh initializer." << std::endl; );
indexSet.insert( superentityIndex );
}
void initSuperentities( MeshInitializerType& meshInitializer )
{
Assert( dynamicStorageNetwork.size() > 0,
TNL_ASSERT( dynamicStorageNetwork.size() > 0,
std::cerr << "No superentity indices were collected. This is a bug in the mesh initializer." << std::endl; );
Assert( (size_t) getMaxSuperentityIndex() == dynamicStorageNetwork.size() - 1,
std::cerr << "Superentities for some entities are missing. "
<< "This is probably a bug in the mesh initializer." << std::endl; );
TNL_ASSERT( (size_t) getMaxSuperentityIndex() == dynamicStorageNetwork.size() - 1,
std::cerr << "Superentities for some entities are missing. "
<< "This is probably a bug in the mesh initializer." << std::endl; );
SuperentityStorageNetwork& superentityStorageNetwork = meshInitializer.template meshSuperentityStorageNetwork< EntityTopology, SuperdimensionTag::value >();
Assert( (size_t) superentityStorageNetwork.getKeysRange() == dynamicStorageNetwork.size(),
std::cerr << "Sizes of the static and dynamic storage networks don't match. "
<< "This is probably a bug in the mesh initializer." << std::endl; );
TNL_ASSERT( (size_t) superentityStorageNetwork.getKeysRange() == dynamicStorageNetwork.size(),
std::cerr << "Sizes of the static and dynamic storage networks don't match. "
<< "This is probably a bug in the mesh initializer." << std::endl; );
typename SuperentityStorageNetwork::ValuesAllocationVectorType storageNetworkAllocationVector;
storageNetworkAllocationVector.setSize( superentityStorageNetwork.getKeysRange() );
......
......@@ -222,7 +222,7 @@ protected:
using BaseType::getSubentityOrientation;
const IdPermutationArrayType& getSubentityOrientation( DimensionTag, LocalIndexType index) const
{
Assert( 0 <= index && index < SubentityTraitsType::count, );
TNL_ASSERT( 0 <= index && index < SubentityTraitsType::count, );
return this->subentityOrientations[ index ].getSubvertexPermutation();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment