tnl-dev issueshttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues2020-07-29T11:35:11Zhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/81Fix reorderEntities for DistributedMesh2020-07-29T11:35:11ZJakub KlinkovskýFix reorderEntities for DistributedMeshThe current naïve implementation cannot work - `DistributedMeshSynchronizer` assumes that global indices of local entities are sorted, so we should update the global indices too and exchange the new global indices for ghost entities.The current naïve implementation cannot work - `DistributedMeshSynchronizer` assumes that global indices of local entities are sorted, so we should update the global indices too and exchange the new global indices for ghost entities.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/80Silence of unused variable warning2020-07-12T10:22:44ZTomáš JakubecSilence of unused variable warningIt would be nice to silence the warnings caused by unused variables. There are several ways to do it:
1. do not name the unused argument (not preferable),
2. use [[maybe_unused]] (since C++17) in function definition,
3. typecast the unus...It would be nice to silence the warnings caused by unused variables. There are several ways to do it:
1. do not name the unused argument (not preferable),
2. use [[maybe_unused]] (since C++17) in function definition,
3. typecast the unused variable (void) var. This approach is used in Qt.
For example consider the following function:
```c++
static std::string name( CudaStatusType error_code )
{
#ifdef HAVE_CUDA
return cudaGetErrorName( error_code );
#else
(void) error_code;
throw CudaSupportMissing();
#endif
}
```
The approach in [Qt](https://doc.qt.io/qt-5/qtglobal.html#Q_UNUSED) discussed [here](https://stackoverflow.com/questions/19576884/does-q-unused-have-any-side-effects) is the following:
```c++
#define UNUSED(var) (void) var
```
Then, the warning can be silenced by `UNUSED(error_code);`.Tomáš JakubecTomáš Jakubechttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/79StaticComparison bug2021-12-09T14:26:52ZTomáš JakubecStaticComparison bugTesting the following code:
```c++
#include <iostream>
#include <GTMesh/Debug/Debug.h>
#include <TNL/Containers/StaticVector.h>
#include <TNL/Containers/Vector.h>
using namespace std;
template<int Dim, typename Real>
struct std::numeric_...Testing the following code:
```c++
#include <iostream>
#include <GTMesh/Debug/Debug.h>
#include <TNL/Containers/StaticVector.h>
#include <TNL/Containers/Vector.h>
using namespace std;
template<int Dim, typename Real>
struct std::numeric_limits<TNL::Containers::StaticVector<Dim, Real>>{
static constexpr bool is_specialized = true;
static TNL::Containers::StaticVector<Dim, Real> max(){
TNL::Containers::StaticVector<Dim, Real> res;
res = std::numeric_limits<Real>::max();
return res;
}
static TNL::Containers::StaticVector<Dim, Real> lowest(){
TNL::Containers::StaticVector<Dim, Real> res;
res = std::numeric_limits<Real>::lowest();
return res;
}
};
using namespace TNL;
int main()
{
TNL::Containers::Vector<TNL::Containers::StaticVector<3,int>, TNL::Devices::Host, size_t> a;
a.setSize(2);
a[0] = TNL::Containers::StaticVector<3,int>{5,-3,6};
a[1] = TNL::Containers::StaticVector<3,int>{8, 1, -5};
TNL::Containers::StaticVector<3,int> a1 = a[0];
TNL::Containers::StaticVector<3,int> a2 = a[1];
DBGVAR(a); // == ..\lookup_problem\main.cpp << 36 >> [[ a ]] ==> [ [ 5, -3, 6 ], [ 8, 1, -5 ] ]
DBGVAR((a1 < a2), (a2 < a1)); // == ..\lookup_problem\main.cpp << 37 >> [[ (a1 < a2) ]] ==> false
// == ..\lookup_problem\main.cpp << 37 >> [[ (a2 < a1) ]] ==> false
DBGVAR(min(a)); // == ..\lookup_problem\main.cpp << 39 >> [[ min(a) ]] ==> [ 5, -3, -5 ]
DBGVAR(min(a1,a2), min(a2,a1));// == ..\lookup_problem\main.cpp << 40 >> [[ min(a1,a2) ]] ==> [ 5, -3, 6 ]
// == ..\lookup_problem\main.cpp << 40 >> [[ min(a2,a1) ]] ==> [ 8, 1, -5 ]
DBGVAR(TNL::min(a1, a2)); // == ..\lookup_problem\main.cpp << 42 >> [[ TNL::min(a1, a2) ]] ==> [ 5, -3, -5 ]
return 0;
}
```
The first problem is the comparison of `a1` and `a2`. If the `(a1 < a2)` is false the `(a2 < a1)` must be true. However in both cases, the result is false, which is incorrect. The comparison utilizes the `StaticCompare::LT` defined as:
```c++
__cuda_callable__
static bool LT( const T1& a, const T2& b )
{
TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not fit." );
for( int i = 0; i < a.getSize(); i++ )
if( ! (a[ i ] < b[ i ]) )
return false;
return true;
}
```
This function does not realize a suitable comparison, e.g., lexicographical.
Secondly, there is a difference in call of min. Both `min(a)` and `TNL::min(a1, a2)` utilize `StaticBinaryExpressionTemplate< ET1, ET2, Min >`, which results in retuning a vector with minimum in each element separately (which is awesome). However, `min(a1, a2)` `min` from stl is called (the `std::min` is prioritized over `TNL::Containers::Expressions::min`) and it employs `StaticCompare::LT` through `operator<`. This problem is solved by removing `using namespace std` (which is partialy my mistake, but worth mentioning). The incorrect implementation of `StaticCompare::LT` results in dependency of the result on the order of the arguments of `min`.
The macro `DBGVAR` is defined in the [GTMesh library](https://mmg-gitlab.fjfi.cvut.cz/gitlab/jakubec/GTMesh).Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/78CUDA reduction does not work with result type whose alignment is not 8, 16, 3...2020-07-10T13:05:48ZJakub KlinkovskýCUDA reduction does not work with result type whose alignment is not 8, 16, 32 or 64 bitsThe implementation relies on `extern __shared__` variables, which are very restricted - see the comment in [SharedMemory.h](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/aaccf135a29513f270c7f34de3a2bdeeaaf3cfc5/src/TNL/Cuda/S...The implementation relies on `extern __shared__` variables, which are very restricted - see the comment in [SharedMemory.h](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/aaccf135a29513f270c7f34de3a2bdeeaaf3cfc5/src/TNL/Cuda/SharedMemory.h). There are specializations only for 8, 16, 32 and 64 bit types and it is not possible to make it general for any type, so CUDA reduction does not work for types such as `StaticVector< 5, double >` or general `struct`s whose size may not even be power of 2.
It would be much easier to use static size arrays for the shared memory (i.e. without `extern`). It is possible, since we only launch reduction kernels with a constant block size.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/76Grids todo list2021-09-28T19:58:15ZJakub KlinkovskýGrids todo listContinuing #52...
- [x] use `.vti` files for the storage of grids, drop `TNLReader`
- [ ] `getEntityIndex()` should be removed from grid - users should call `entity.getIndex()`
- [ ] `getEntity()` and `getEntitiesCount()` should have `i...Continuing #52...
- [x] use `.vti` files for the storage of grids, drop `TNLReader`
- [ ] `getEntityIndex()` should be removed from grid - users should call `entity.getIndex()`
- [ ] `getEntity()` and `getEntitiesCount()` should have `int Dimension` template parameter
- [ ] `isBoundaryEntity()` should be moved from `GridEntity` to `Grid` - it is not only an entity attribute, it is always bound to the particular mesh.
Generally, entities might be shared between multiple submeshes, so the method does not make sense in the general interface.
There might also be read-only views for partitions of the mesh (see vienna-grid).
- <s>[ ] the `getMesh()` method should be removed from `GridEntity` - for the same reason as `isBoundaryEntity()`
(it is also an optimization because the size of the entity structure will be smaller)</s>
- [ ] `getCenter()` and `getMeasure()` should be plain functions taking a `Mesh` and `MeshEntity` as parameters.
This is because general MeshEntity stores only indices of the subvertices, the points have to be accessed via Mesh class.
See also [Effective C++ Item 23 Prefer non-member non-friend functions to member functions](https://stackoverflow.com/questions/5989734/effective-c-item-23-prefer-non-member-non-friend-functions-to-member-functions) and the [Open-closed principle](https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle).https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/75Fix/improve the implementation of mesh entity orientations2021-04-11T08:03:13ZJakub KlinkovskýFix/improve the implementation of mesh entity orientationsCurrently it is untested and inefficient because it is based on storing the whole subvertex permutations for each entity. We need to better understand what information is needed for FVM and improve the implementation.Currently it is untested and inefficient because it is based on storing the whole subvertex permutations for each entity. We need to better understand what information is needed for FVM and improve the implementation.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/74Implement MeshView and maybe DistributedMeshView2020-06-24T12:30:48ZJakub KlinkovskýImplement MeshView and maybe DistributedMeshViewThere should be support for sub-configurations, so that light views could be initialized by a full mesh, e.g. a view including only cells, vertices and links from cells to their subvertices. The same can be done with `Mesh`'s copy-constr...There should be support for sub-configurations, so that light views could be initialized by a full mesh, e.g. a view including only cells, vertices and links from cells to their subvertices. The same can be done with `Mesh`'s copy-constructor.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/73Generalize DistributedMeshSynchronizer for faces2020-07-30T12:54:43ZJakub KlinkovskýGeneralize DistributedMeshSynchronizer for facesIf possible, for any subentity topology.
First, faces have to be assigned an owner subdomain. A hypothesis is that this can be done by checking if all subvertices are local (thanks to the way we assign an owner subdomain to vertices).If possible, for any subentity topology.
First, faces have to be assigned an owner subdomain. A hypothesis is that this can be done by checking if all subvertices are local (thanks to the way we assign an owner subdomain to vertices).Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/72Simplify interface of loadDistributedMesh and distributeMesh2021-07-01T06:55:30ZJakub KlinkovskýSimplify interface of loadDistributedMesh and distributeMeshThe `loadDistributedMesh` and `distributeMesh` functions were written specifically for the distributed grid, but they don't match the interface of the general distributed mesh.
- only the distributed mesh should be passed to `loadDistri...The `loadDistributedMesh` and `distributeMesh` functions were written specifically for the distributed grid, but they don't match the interface of the general distributed mesh.
- only the distributed mesh should be passed to `loadDistributedMesh`, the local mesh can be obtained with `mesh.getLocalMesh()` (at least for the distributed mesh, distributed grid has an inverse relation with the local grid)
- `distributeMesh` should not be used at all with a general distributed mesh (decomposition is done by `tnl-decompose-mesh`, then it is loaded with `PVTUReader`). Try to merge `distributeMesh` for grids with the overload of `loadDistributedMesh` for grids.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/71Overload functions l2Norm and lpNorm for 1D StaticVector2021-01-08T17:27:33ZJakub KlinkovskýOverload functions l2Norm and lpNorm for 1D StaticVectorFor 1D vectors, the `l2Norm` and `lpNorm` functions are equivalent to taking the absolute value of the 0-th component, so there should be overloads avoiding the expensive calls to `TNL::sqrt` and `TNL::pow`.
Then remove `getVectorLength...For 1D vectors, the `l2Norm` and `lpNorm` functions are equivalent to taking the absolute value of the 0-th component, so there should be overloads avoiding the expensive calls to `TNL::sqrt` and `TNL::pow`.
Then remove `getVectorLength` from [getEntityMeasure.h](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/develop/src/TNL/Meshes/Geometry/getEntityMeasure.h#L53-68).Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/70Implement parsing of binary data in VTKReader2021-05-13T20:51:06ZJakub KlinkovskýImplement parsing of binary data in VTKReaderThe `VTKReader` (for the legacy VTK format) can read only ASCII data, but `VTKWriter` can write ASCII or binary.The `VTKReader` (for the legacy VTK format) can read only ASCII data, but `VTKWriter` can write ASCII or binary.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/69Implement parsing of ASCII arrays in the XMLVTK class2021-05-13T20:51:05ZJakub KlinkovskýImplement parsing of ASCII arrays in the XMLVTK classThis is not finished in !65.This is not finished in !65.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/68Remove template parameter `isBinary_` from SparseMatrixRowView2021-04-13T19:27:05ZJakub KlinkovskýRemove template parameter `isBinary_` from SparseMatrixRowViewThe method `SparseMatrixRowView::isBinary()` can be implemented by checking if `RealType` is `bool`, the same way as in `SparseMatrix`.The method `SparseMatrixRowView::isBinary()` can be implemented by checking if `RealType` is `bool`, the same way as in `SparseMatrix`.Tomáš OberhuberTomáš Oberhuberhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/67Missing segmentsCount attribute in BiEllpack and ChunkedEllpack2020-05-09T10:05:31ZJakub KlinkovskýMissing segmentsCount attribute in BiEllpack and ChunkedEllpackSee https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/TO/matrices/src/TNL/Containers/Segments/BiEllpack.hpp#L351-360 and https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/TO/matrices/src/TNL/Containers/Segments/ChunkedEll...See https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/TO/matrices/src/TNL/Containers/Segments/BiEllpack.hpp#L351-360 and https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/TO/matrices/src/TNL/Containers/Segments/ChunkedEllpack.hpp#L304-312Tomáš OberhuberTomáš Oberhuberhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/66Matrix::operator== does not work2020-05-09T10:08:11ZJakub KlinkovskýMatrix::operator== does not workThe [operator==](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/TO/matrices/src/TNL/Matrices/Matrix.hpp#L144-159) in `Matrix` uses `getElement` which is not defined in `Matrix`:
```cpp
../src/TNL/Matrices/Matrix.hpp:156:20: e...The [operator==](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/TO/matrices/src/TNL/Matrices/Matrix.hpp#L144-159) in `Matrix` uses `getElement` which is not defined in `Matrix`:
```cpp
../src/TNL/Matrices/Matrix.hpp:156:20: error: ‘const class TNL::Matrices::Matrix<bool, TNL::Devices::Host, int, std::allocator<bool> >’ has no member named ‘getElement’
156 | if( this->getElement( row, column ) != matrix.getElement( row, column ) )
| ~~~~~~^~~~~~~~~~
```Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/65SparseMatrixView::rowVectorProduct is not implemented2020-05-09T10:05:31ZJakub KlinkovskýSparseMatrixView::rowVectorProduct is not implementedSee https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/develop/src/TNL/Matrices/SparseMatrixView.hpp#L345-358See https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/develop/src/TNL/Matrices/SparseMatrixView.hpp#L345-358Tomáš OberhuberTomáš Oberhuberhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/64SparseMatrix attributes are not protected2020-06-17T05:59:38ZJakub KlinkovskýSparseMatrix attributes are not protectedSee https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/develop/src/TNL/Matrices/SparseMatrix.h#L228-229See https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/blob/develop/src/TNL/Matrices/SparseMatrix.h#L228-229Tomáš OberhuberTomáš Oberhuberhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/63Loading of the matrix circuit5M2020-06-20T09:33:14ZLukáš Matthew ČejkaLoading of the matrix circuit5MThe matrix circuit5M.mtx from the Florida Matrix Market takes days to load for some reason.
Further investigation is needed.The matrix circuit5M.mtx from the Florida Matrix Market takes days to load for some reason.
Further investigation is needed.Lukáš Matthew ČejkaLukáš Matthew Čejkahttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/62Recording errors into logs2021-11-17T16:39:52ZLukáš Matthew ČejkaRecording errors into logsCurrently, any input into logs consists of hardware information, or Benchmark results.
However, if a Matrix fails to be allocated, there needs to be some sort of way to record this in the logs.Currently, any input into logs consists of hardware information, or Benchmark results.
However, if a Matrix fails to be allocated, there needs to be some sort of way to record this in the logs.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/61absolute value of vector of vertors2020-07-10T13:05:47ZTomáš Jakubecabsolute value of vector of vertorsThis code does not compile.
```c++
TNL::Containers::Vector<TNL::Containers::StaticVector<3,int>, TNL::Devices::Host, size_t> vec;
vec.setSize(2);
vec = TNL::Containers::StaticVector<3,int>{1,-2,3};
TNL::abs(a); // error
...This code does not compile.
```c++
TNL::Containers::Vector<TNL::Containers::StaticVector<3,int>, TNL::Devices::Host, size_t> vec;
vec.setSize(2);
vec = TNL::Containers::StaticVector<3,int>{1,-2,3};
TNL::abs(a); // error
```
The compiler does not see this funciton from the context of function `Abs::evaluate`:
```c++
////
// Abs
template< int Size, typename Real >
__cuda_callable__
auto
abs( const Containers::StaticVector< Size, Real >& a )
{
return Containers::Expressions::StaticUnaryExpressionTemplate< Containers::StaticVector< Size, Real >, Containers::Expressions::Abs >( a );
}
```
and the only visible function from the context is this one.
```c++
template< class T,
std::enable_if_t< ! std::is_unsigned<T>::value, bool > = true>
__cuda_callable__ inline
T abs( const T& n );
```
It does not apply the right function because the function `abs( const Containers::StaticVector< Size, Real >& a )` is in the namespace TNL instead of TNL::Containers as its argument is. Moreover, the `Abs::evaluate` calls `TNL::abs` which does not trigger ADL (argument dependent lookup), see [this](https://stackoverflow.com/questions/12530174/template-function-lookup). By the way that is the reason why operators +,-, etc. works properly. The same problem applies to other expression functions.Jakub KlinkovskýJakub Klinkovský